Using a function file I tried to call "loot give @s loot <loot table> which gave me an invisible item that took up a slot in my inventory. I tried executing the same function file over and over with no results. My inventory updated once I called the loot table myself ingame and gave me every item that I had called each time.
Strangely it doesn't update if my inventory changes in any other way (eg, calling a different loot table, even manually), and the space in my inventory will still be taken up
This may be related to MC-197349
Linked issues
duplicates 1
Attachments
Comments 3

Attached the data pack used. Use the command "/loot give @s loot potatopack:tarnished_banner" and attempt to place it on Peaceful difficulty in Survival.
The result should be that the banner is added back to your inventory through the function "potatopack:block/tarnished_banner/place/fail/start", but instead an invisible item takes up a slot. You can see that this happens if you pick up some other items or run other loot commands, and when you run the "/loot give @s loot potatopack:tarnished_banner" command manually again, the slot is updated

The issue here is that your advancement potatopack:technical/block/tarnished_banner/place
detects when a Survival player places an armour stand, and then gives them an identical armour stand in the same tick. It is a known issue (MC-239935) that this creates a ghost item. As a workaround, you could include some kind of unique identifier somewhere in the NBT of each "tarnished banner" item.
Please attach the data pack you used, so this can be investigated.