When a /clear command gets powerd, while your inventory is open and you are holding an item at your cursor, it will not be removed.
STEPS TO REPRODUCE:
1 Build the sircuit shown in the screenshots or download the map.
2 Put some items in your inventory
3 Press the button
4 Take one item on your cursor befor the signal reaches the CommandBlock
5 All items will be cleared out of your inventory, only that on the cursor will be left
Probably duplicate of MC-41113