At times, villagers become preoccupied with trading carrots (or, presumably, other crops). They form clusters and repeatedly throw them at each other, only to throw them back again. The attached video shows this happening in a particular desert village that has 13 villagers, 12 of them farmers. On several occasions I have seen 12 of the 13 engaged in this pointless activity.
Thinking that their inventories were full, I checked with an NBT editor. The 4 villagers in this video each had from 3 to 6 carrots in its inventory, two of them had 3 and 5 carrots in their main hands, and all had 3 or 4 empty slots, so that wasn't why they were swapping. Note that I have also seen these villagers walking around with carrots in their main hands when they weren't engaged in swapping. It makes me wonder whether their AI doesn't allow them to have more than a small number of carrots in their inventories. Each swap might then exceed the recipient's limit, causing the behavior to repeat without limit.