SQLite Error Code Reference
Every significant SQLite result code explained — what it means, why it happens, and how to fix it. Python and CLI examples included for every entry.
⚙️ Error examples are AI-generated to help developers and are subject to the occasional error. Always verify against your specific version and setup.
SQL logic error
Generic Error
database is locked
Locking & Concurrency
database table is locked
Locking & Concurrency
attempt to write a readonly database
Access Control
disk I/O error
I/O Error
database disk image is malformed
Database Corruption
database or disk is full
Resource Limit
unable to open database file
File Access
database schema has changed
Schema
string or blob too big
Resource Limit
constraint failed
Constraint Violation
UNIQUE constraint failed (primary key)
Constraint Violation
UNIQUE constraint failed
Constraint Violation
FOREIGN KEY constraint failed
Constraint Violation
NOT NULL constraint failed
Constraint Violation
CHECK constraint failed
Constraint Violation
cannot start a transaction within a transaction (WAL snapshot conflict)
Locking & Concurrency
disk I/O error (write failure)
I/O Error
database disk image is malformed (virtual table)
Database Corruption
unable to open a temporary database file for storing temporary tables
File Access
attempt to write a readonly database (hot journal present)
Access Control
datatype mismatch
Type Error
bad parameter or other API misuse
API Misuse
not authorized
Access Control
file is not a database
File Access
About This Reference
This SQLite error code reference covers 25 of the most common result codes encountered when building applications with SQLite. Each entry includes the numeric result code from sqlite3.h, a Python trigger example, a verified fix with mechanism explanation, and sources from the official SQLite documentation. Extended result codes (such as SQLITE_CONSTRAINT_UNIQUE and SQLITE_BUSY_SNAPSHOT) are covered alongside their base codes.