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.

105 of 105 result codes21 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

SQLITE_OK

Successful result

Success

SQLITE_INTERNAL

Internal logic error in SQLite

Internal Error

SQLITE_PERM

Access permission denied

Permissions

SQLITE_ABORT

Callback routine requested an abort

Transaction

SQLITE_NOMEM

malloc() failed — out of memory

Resource

SQLITE_INTERRUPT

Operation terminated by sqlite3_interrupt()

Control Flow

SQLITE_NOTFOUND

Unknown opcode or table/row not found

Not Found

SQLITE_PROTOCOL

Database locking protocol error

Locking

SQLITE_EMPTY

Internal use only (not used by SQLite)

Internal

SQLITE_NOLFS

Large file support is disabled

Filesystem

SQLITE_FORMAT

Auxiliary database format error (not used)

Internal

SQLITE_RANGE

Bind or column index out of range

API Misuse

SQLITE_NOTICE

Notification from sqlite3_log()

Logging

SQLITE_WARNING

Warning from sqlite3_log()

Logging

SQLITE_ROW

sqlite3_step() has another row ready

Step Result

SQLITE_DONE

sqlite3_step() finished executing

Step Result

SQLITE_ERROR_MISSING_COLLSEQ

Missing collating sequence

Collation

SQLITE_ABORT_ROLLBACK

Statement aborted due to ROLLBACK

Transaction

SQLITE_BUSY_RECOVERY

Busy: another connection is recovering WAL

Locking

SQLITE_BUSY_SNAPSHOT

Busy: WAL snapshot is out of date

Locking

SQLITE_BUSY_TIMEOUT

Busy: timeout waiting for lock

Locking

SQLITE_LOCKED_SHAREDCACHE

Locked due to shared-cache contention

Locking

SQLITE_READONLY_RECOVERY

Read-only: WAL recovery required by another connection

Read-Only

SQLITE_READONLY_CANTLOCK

Read-only: unable to obtain shared lock

Read-Only

SQLITE_READONLY_ROLLBACK

Read-only: rollback journal prevents read

Read-Only

SQLITE_CANTOPEN_ISDIR

Cannot open — path is a directory

File Access

SQLITE_CANTOPEN_FULLPATH

Cannot open — full path resolution failed

File Access

SQLITE_CANTOPEN_SYMLINK

Cannot open — symlinks not allowed

File Access

SQLITE_CORRUPT_VTAB

Virtual table content is corrupt

Corruption

SQLITE_CORRUPT_SEQUENCE

sqlite_sequence table is corrupt

Corruption

SQLITE_CORRUPT_INDEX

Index is inconsistent with table

Corruption

SQLITE_CONSTRAINT_CHECK

CHECK constraint failed

Constraint

SQLITE_CONSTRAINT_FOREIGNKEY

FOREIGN KEY constraint failed

Constraint

SQLITE_CONSTRAINT_NOTNULL

NOT NULL constraint failed

Constraint

SQLITE_CONSTRAINT_PRIMARYKEY

PRIMARY KEY constraint failed

Constraint

SQLITE_CONSTRAINT_UNIQUE

UNIQUE constraint failed

Constraint

SQLITE_CONSTRAINT_ROWID

Rowid is not unique

Constraint

SQLITE_CONSTRAINT_DATATYPE

Strict table datatype constraint failed

Constraint

SQLITE_NOTICE_RECOVER_WAL

WAL file recovery in progress (log notice)

Logging

SQLITE_NOTICE_RECOVER_ROLLBACK

Hot journal rollback in progress (log notice)

Logging

SQLITE_WARNING_AUTOINDEX

Query using automatic index (log warning)

Performance

SQLITE_OK_LOAD_PERMANENTLY

Extension loaded permanently into SQLite

Extension

SQLITE_IOERR_READ

I/O error during file read

I/O Error

SQLITE_IOERR_SHORT_READ

I/O error: short read (unexpected EOF)

I/O Error

SQLITE_IOERR_WRITE

I/O error during file write

I/O Error

SQLITE_IOERR_FSYNC

I/O error during fsync()

I/O Error

SQLITE_IOERR_TRUNCATE

I/O error during file truncation

I/O Error

SQLITE_IOERR_DELETE

I/O error deleting journal file

I/O Error

SQLITE_IOERR_NOMEM

I/O subsystem out of memory

I/O Error

SQLITE_IOERR_LOCK

I/O error obtaining file lock

I/O Error

SQLITE_IOERR_MMAP

I/O error during memory-mapped file access

I/O Error

SQLITE_IOERR_BEGIN_ATOMIC

I/O error starting atomic write

I/O Error

SQLITE_IOERR_COMMIT_ATOMIC

I/O error committing atomic write

I/O Error

SQLITE_IOERR_ROLLBACK_ATOMIC

I/O error rolling back atomic write

I/O Error

SQLITE_IOERR_SHMMAP

I/O error memory-mapping WAL shared memory

I/O Error

SQLITE_IOERR_SEEK

I/O error during file seek

I/O Error

SQLITE_IOERR_DELETE_NOENT

I/O error deleting non-existent file

I/O Error

SQLITE_IOERR_CORRUPTFS

I/O error — filesystem is corrupt

I/O Error

SQLITE_LOCKED_VTAB

Virtual table is locked

Locking

SQLITE_READONLY_DBMOVED

Read-only: database file has been moved

Read-Only

SQLITE_READONLY_CANTINIT

Read-only: unable to initialise shared memory

Read-Only

SQLITE_READONLY_DIRECTORY

Read-only: journal directory is not writable

Read-Only

SQLITE_CONSTRAINT_COMMITHOOK

Commit hook requested rollback

Constraint

SQLITE_CONSTRAINT_TRIGGER

Constraint raised by a trigger

Constraint

SQLITE_CONSTRAINT_VTAB

Virtual table constraint violation

Constraint

SQLITE_CONSTRAINT_PINNED

Cannot delete a row required by a rowid scan

Constraint

SQLITE_AUTH_USER

Authorisation denied by user

Authorisation

SQLITE_OK_SYMLINK

File is a symlink (success with note)

File Access

SQLITE_ERROR_RETRY

Internal retry signal (not user-facing)

Internal

SQLITE_ERROR_SNAPSHOT

Snapshot is out of date

Snapshot

SQLITE_NOTICE_RBU

RBU update notice from sqlite3_log()

Logging

SQLITE_IOERR_DATA

I/O error: data integrity check failed

I/O Error

SQLITE_IOERR_DIR_FSYNC

I/O error syncing the journal directory

I/O Error

SQLITE_IOERR_UNLOCK

I/O error releasing file lock

I/O Error

SQLITE_IOERR_RDLOCK

I/O error checking reserved read lock

I/O Error

SQLITE_IOERR_ACCESS

I/O error checking file existence/access

I/O Error

SQLITE_IOERR_CLOSE

I/O error closing file descriptor

I/O Error

SQLITE_IOERR_SHMOPEN

I/O error opening WAL shared-memory file

I/O Error

SQLITE_IOERR_SHMSIZE

I/O error resizing WAL shared-memory file

I/O Error

SQLITE_IOERR_GETTEMPPATH

I/O error finding a temporary directory

I/O Error

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.