If a transaction is out of balance because one of more of the amounts is not associated with an account, which does seem to happen from time to time, the only way to fix that is to edit the transaction and add an account to the transaction row(s) that don't have an account - is to fix the broken/invalid transaction.
If you must, then you can reverse the effect of that change with a Journal, or something like that.