Seaquel
SQL Server error code

SQL Server error 3991

SQL Server raises error 3991 at severity 16, which marks a problem with the query or data that you can correct.

The context transaction which was active before entering user defined routine, trigger or aggregate "%.*ls" has been ended inside of it, which is not allowed. Change application logic to enforce strict transaction nesting.
Msg3991
Severity16
Group3000–3999

Source: Database Engine events and errors