This is a very odd one....
Summon the villager like this:
execute align xyz run summon minecraft:villager ~0.5 ~ ~0.5 {VillagerData:{profession:"minecraft:nitwit",level:6},Offers:{Recipes:[{rewardExp:1b,xp:2,maxUses:1000000,buy:{id:"minecraft:stone",Count:1b},sell:{id:"minecraft:written_book",Count:1b,tag:{author:"Test",title:"Test",bclott_tid:0,bclott_action:"ticket",pages:['{"nbt":"Inventory[{Slot:0b}].id","entity":"@s"}']}}}]}}
Trade him a stone for a book, open the book while looking at the villager.
The villager can now not be traded with.
The duration of this state varies, sometimes you can trade on a second attempt, sometimes it seems like it's never going to become tradeable again.
Linked issues
relates to 1
Comments 4
The command provided in the description was so long that copying and pasting didn’t paste the whole command, so I tested this with the command from MC-141494 instead.
/summon villager ~ ~1 ~ {NoAI:1,Offers:{Recipes:[{buy:{id:air,Count:0},sell:{id:air,Count:0}}]}}
I was able to successfully reproduce this every time with the villager from that command. I also tried to reproduce this with villagers from spawn eggs (that I had provided work stations for) but reproduction was unreliable with them.
This might be a client-server desync because this bug can also be used to create “ghost” items.
Put something in your off-hand.
Have a signed written book and an empty space on your hotbar.
Right-click on the villager while holding the written book.
Select the empty space on your hotbar.
Press the hotkey that switches items between you main-hand and your off-hand.
The real item is now in your main-hand and a duplicate “ghost” item is in your off-hand.
The “ghost” item can disappear by itself at any moment and if it was a block, it will disappear when you place it.
Alex Smith’s comment on MC-141494 describes more effects of right-clicking on a villager with a signed written book.