Steps to reproduce:
Spawn a Sulfur Cube with a spawn egg of by running the below command:
/summon sulfur_cubePlace an item or block inside it (such as tnt):
/replaceitem entity @e[type=sulfur_cube,c=1] slot.weapon.mainhand 0 tntTry to target it with hasitem filter:
/execute as @e[type=sulfur_cube,hasitem={item=tnt}] run say hiExpected Result: A “hi” message in chat.
What actually happens: “No targets matched selector.” message in chat.
Thank you for helping us improve Minecraft! We saved your files: