It could be not proper performing stack checks on compilation, for functions like the dispatcher, branches may result in different output, which break the balance of the stack!
for example, in the implementation of huff, we can see they specified the stack output of each function: https://docs.huff.sh/get-started/huff-by-example/#custom-errors
I believe there are sort of solutions in https://docs.huff.sh/tutorial/function-dispatching/#linear-dispatching that can help us finish our work for the stack checks