Affects Version/s: 1.15.2, 1.16.1, 1.16.2 Pre-release 3
Fix Version/s: 21w10a
When calling setblock from a book (in a lectern or in hand), the block will be set. If a commandblock executing the clear command is being executed by that, ghost items are created only if the book was in a lactern, but not otherwise.
How to reproduce
Execute these two commands (if necessary, using a commandblock) to get the lectern and the command block:
Stand still. Place the commandblock to the east so that there are 3 spaces between you and the commandblock. (~4 ~ ~) Place the lectern to the east right next to you. (~1 ~ ~)
Click on the lectern, click the text, the redstoneblock will appear, the commandblock's output will tell you "Removed 2 items from player" and you'll have ghost-items in your toolbar.
Take the book from the lectern, open it while in your toolbar, click the text, the redstoneblock will appear, the commandblock's output will tell you "Removed 2 items from player" and your items will be gone without leaving ghost-items.
This bug seems to be in correlation with MC-154094.