// SQLite error reference

SQLITE_ABORT: query aborted

An operation stopped before finishing, usually by request: an sqlite3_exec() callback returned non-zero, or a ROLLBACK ended a pending read or write.

Result code
SQLITE_ABORT
Name
4
Category
Primary result codes
Error message
query aborted

What it means

SQLITE_ABORT (4) means an operation was cut short. The SQLite documentation lists two everyday cases: the callback passed to sqlite3_exec() returned non-zero, which tells SQLite to stop; or a ROLLBACK ran on the same connection while a read or write was pending, in which case the pending statement fails with SQLITE_ABORT or the extended SQLITE_ABORT_ROLLBACK.

Common causes

  • A row callback in sqlite3_exec() returned non-zero (in some bindings, an exception thrown from the callback).
  • A ROLLBACK on the connection while another statement on it was still being stepped.
  • A RAISE(ABORT, ...) in a trigger, which reports as a constraint error with the trigger's message.

How to fix it

  1. If you use sqlite3_exec() with a callback, make sure it returns 0 to continue.

  2. Finish or reset open statements before rolling back, and don't issue ROLLBACK from one part of the program while another is still reading on the same connection.

Related errors

More primary result codes errors

The code and message text are from the SQLite result and error codes documentation. Browse the full SQLite error list or search every database error.

// fewer errors, faster fixes

Work on SQLite in SQLly

A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for SQLite and the other databases you use.