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.

25 of 25 result codes4 critical23 HIGH confidence
SQLITE_ERROR

SQL logic error

Generic Error

SQLITE_BUSY

database is locked

Locking & Concurrency

SQLITE_LOCKED

database table is locked

Locking & Concurrency

SQLITE_READONLY

attempt to write a readonly database

Access Control

SQLITE_IOERR

disk I/O error

I/O Error

SQLITE_CORRUPT

database disk image is malformed

Database Corruption

SQLITE_FULL

database or disk is full

Resource Limit

SQLITE_CANTOPEN

unable to open database file

File Access

SQLITE_SCHEMA

database schema has changed

Schema

SQLITE_TOOBIG

string or blob too big

Resource Limit

SQLITE_CONSTRAINT

constraint failed

Constraint Violation

SQLITE_CONSTRAINT_PRIMARYKEY

UNIQUE constraint failed (primary key)

Constraint Violation

SQLITE_CONSTRAINT_UNIQUE

UNIQUE constraint failed

Constraint Violation

SQLITE_CONSTRAINT_FOREIGNKEY

FOREIGN KEY constraint failed

Constraint Violation

SQLITE_CONSTRAINT_NOTNULL

NOT NULL constraint failed

Constraint Violation

SQLITE_CONSTRAINT_CHECK

CHECK constraint failed

Constraint Violation

SQLITE_BUSY_SNAPSHOT

cannot start a transaction within a transaction (WAL snapshot conflict)

Locking & Concurrency

SQLITE_IOERR_WRITE

disk I/O error (write failure)

I/O Error

SQLITE_CORRUPT_VTAB

database disk image is malformed (virtual table)

Database Corruption

SQLITE_CANTOPEN_NOTEMPDIR

unable to open a temporary database file for storing temporary tables

File Access

SQLITE_READONLY_ROLLBACK

attempt to write a readonly database (hot journal present)

Access Control

SQLITE_MISMATCH

datatype mismatch

Type Error

SQLITE_MISUSE

bad parameter or other API misuse

API Misuse

SQLITE_AUTH

not authorized

Access Control

SQLITE_NOTADB

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.