[IGN-3829] Error executing system.db.commitTransaction

Hello beautiful people,

I had this issue a while ago and asked about it (here). @PGriffith redirected me there.
All in all, things got smoother and the error only ever appeared when a transaction was opened but there was nothing to commit. Which I fixed easily, by making sure not to open the transaction if there was no query to run.

But a few days ago, things got weird again.
I'm running queries, and I can see in my database that records were indeed inserted just fine, but I get a java.lang.Exception: Error executing system.db.closeTransaction error with this in the stack trace:

Caused by: org.python.core.PyException: java.lang.Exception: java.lang.Exception: Error executing system.db.closeTransaction(5bf23e6b-f299-45c4-8f99-3a3e16a1a5a6)
... 45 common frames omitted
Caused by: java.lang.Exception: Error executing system.db.closeTransaction(5bf23e6b-f299-45c4-8f99-3a3e16a1a5a6)
... 44 common frames omitted
Caused by: java.sql.SQLException: Transaction "5bf23e6b-f299-45c4-8f99-3a3e16a1a5a6" is closed.

To sum it up:

  1. The data is actually inserted
  2. I checked that the transaction ids match
  3. From what I've seen so far this only happens when inserting, not updating.

I'm running 8.17 and can't update.
I'm not sure what to do now.