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).