Bug: Villagers do not accept discounted amount of items for trading. If you have a discount such as a farming villagers giving an emerald for 5 pumpkins discounted from 6 pumpkins. If you try to trade 5 pumpkins for an emerald it won't let you trade. If you have 6 pumpkins you will be able to trade, but it will take all 6 pumpkins, not the shown discounted price.
Note: This bug does not always occur, as the villager will sometimes accept the discounted price.
To recreate trade with a villager until they have discounts and continue to try and trade only the specified number of items/emeralds specified by the discount.
Related issues
duplicates
Comments

Duplicates MC-151282 (fixed).