SQLITE_ABORT_ROLLBACK
SQLiteWARNINGNotableTransactionofficial confidence
Statement aborted due to ROLLBACK
Production Risk
Medium — silent data loss if the abort is not detected and the transaction not retried.
What this means
SQLITE_ABORT_ROLLBACK (516) is an extended result code indicating that a prepared statement was aborted because the transaction it was part of was rolled back. The statement result is invalid and should be discarded.
Why it happens
- 1Concurrent thread or connection issued ROLLBACK while a statement was executing.
- 2Application logic rolled back the transaction mid-execution.
- 3Trigger or ON CONFLICT clause caused an implicit rollback.
How to reproduce
Multithreaded or multi-connection SQLite usage with shared transactions.
trigger — this will error
trigger — this will error
import sqlite3
conn = sqlite3.connect('test.db', check_same_thread=False)
conn.execute('BEGIN')
conn.execute('CREATE TABLE IF NOT EXISTS t(x)')
conn.execute('INSERT INTO t VALUES(1)')
# From another thread or connection:
conn.execute('ROLLBACK')
# Any pending statement now returns SQLITE_ABORT_ROLLBACKexpected output
sqlite3.OperationalError: abort due to ROLLBACK
Fix 1
Fix 2
Fix 3
What not to do
✕
Version notes
Sources
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev