If, for example, you use /clear @a minecraft:wooden_sword 1, when the item is not put in any cell (screenshot 1), a bug will happen. There will be some "Ghost Sword"! This sword will remain in inventory, it can be used, but it can not be removed by the command /clear @a minecraft:wooden_sword 1. The command believes that there is nothing in the inventory (screenshot 2). But if you move the "sword-ghost" in another inventory slot, then the command will work (screenshot 3).
Thank you for your report!
However, this issue has been closed as a Duplicate of MC-41113.
It has been linked to this report. If you have additional information, please add it to the duplicated report.
Please search before reporting, as it's likely that one exists already.
Quick Links:
📓 Issue Guidelines – 💬 Community Support – 📧 Customer Support – 📖 Game Wiki