Rule and trigger code must balance transaction usage (Error 1598)

A rule or trigger expression, or code invoked from an expression, has either started a transaction that it did not finish or finished one that it did not start. The write attempt that fired the rule or trigger code has been aborted.