SQLITE_PROTOCOL: locking protocol
In WAL mode, a connection lost the race to start a transaction many times over several seconds and gave up. Very rare; a sign of heavy write contention.
- Result code
SQLITE_PROTOCOL- Name
15- Category
- Primary result codes
What it means
The SQLite documentation describes SQLITE_PROTOCOL (15) as a problem with the file locking protocol, currently only returned in WAL mode when starting a transaction. When two connections race to start a transaction, the loser backs off and retries; if the same connection keeps losing for several seconds, it returns SQLITE_PROTOCOL. It should appear only with many processes competing hard to write the same database.
Common causes
- Many processes writing the same WAL-mode database at once.
- File locking that misbehaves, for example on a network file system.
How to fix it
-
Reduce the number of concurrent writers, for example by funnelling writes through one process or a queue.
-
Keep the database on a local disk with working locks.
-
Treat it like
SQLITE_BUSY: retry the transaction after a short pause.
Related errors
More primary result codes errors
SQLITE_ERRORSQL logic errorSQLITE_PERMaccess permission deniedSQLITE_ABORTquery abortedSQLITE_LOCKEDdatabase table is lockedSQLITE_NOMEMout of memorySQLITE_READONLYattempt to write a readonly databaseSQLITE_INTERRUPTinterruptedSQLITE_IOERRdisk I/O error
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.
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.