The /clear command has a parameter that you can use to filter what items the command should clear and how many of the given item there should be cleared
The item filter is ignored when /clear clears items in players' inventory crafting grids.
How to recreate:
Place a command block and put the command /clear @p stone 1 into the command block.
Place a button which activates the command block after some time (eg by using repeaters)
Press the button
Open your inventory and put a stack of stone and a stack of dirt into your crafting grid
Wait for the clear command to run.
See both the dirt blocks all the stone was cleared even though only 1 stone block should have been cleared
Linked issues
Comments 2
Forward resolving to MC-172272
It also ignores counts of 0, so when you do /clear @s stone 0 with stone in your crafting grid, it clears it even though it's supposed to just count it.