I got this error.
Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: sum of account balances before and after instruction do not match
Problem solved✔️
In my case I had a function that had two shipments of balances. One through the system program with transfer and another through try_borrow_mut_lamports()?.
First you have to put the transfer function and then the try_borrow_mut_lamports() function