This error occurs if the sum of the debit entries do not match the sum of the credit entries. Often due to in-correct roundings.
You ask “why this error happen”? Answer: Because the developer put it there!
There is a coding bug in your system. Most likely done by the developer who customized this or the related posting function.
So if this developer was you, then you need to debug the whole posting flow and follow all amounts to find out where exactly it went wrong. If you’re not a developer, then contact your partner and ask them to debug and find the error.