What I expected to happen is that the villager would trade me the proper reward for a custom player head
What actually happened was it placed the player head back into my inventory without giving me the proper trade offer
Steps to Reproduce:
Summon a custom villager such as this one:
/summon villager ~ ~1 ~ {VillagerData:{profession:farmer,level:5,type:plains},Offers:{Recipes:[{buy:{id:player_head,Count:1,tag:{SkullOwner:Notch}},sell:{id:emerald,Count:1},maxUses:9999999}]}}
Get the respective player head it wants
/give @p player_head{SkullOwner:Notch}
trade with it
it will not use the head and it won't give you a reward
Can still reproduce in 1.15.2-pre2, but this is likely invalid / intended because the trade does not resolve the player head data, while giving you the item does. However the resolved player head data also contains the timestamp (base64 encoded) so the NBT of the player head trade would never match since you do not create villager and item at the same time.
As a workaround you should probably summon the villager with a trade accepting a player head with
SkullOwner
as NBT compound and use the same compound to create the player head item, e.g.:Villager
Item