pgref.dev/sqlite/errors/SQLITE_PROTOCOL
SQLITE_PROTOCOLERRORTier 2 — Caution⚠️ MEDIUM confidence

Database locking protocol error

Category: LockingVersions: 3.0+

🔴 Production Risk Error

High — concurrent access may corrupt data if the locking protocol diverges.

What this means

SQLITE_PROTOCOL (15) indicates that SQLite detected a file locking protocol failure — another process used an incompatible locking protocol on the same database file.

Why it happens

  1. 1Two processes using different SQLite locking implementations on the same file.
  2. 2Custom VFS with non-compliant lock semantics.
  3. 3NFS or network filesystem not supporting mandatory locks correctly.

How to reproduce

Concurrent access from processes using different SQLite versions or custom VFS layers.

trigger — this will ERROR
# Typically appears as:
# sqlite3.OperationalError: locking protocol
sqlite3.OperationalError: locking protocol

Fix 1

Why this works

Ensure all processes accessing the database file use a compatible SQLite version.

Fix 2

Why this works

Avoid using SQLite on NFS — use WAL mode on a local filesystem instead.

Fix 3

Why this works

If using a custom VFS, verify lock byte handling matches the SQLite spec.

What not to do

Why it's wrong:

Sources

📚 Official docs: https://www.sqlite.org/rescode.html#protocol

🔧 Source ref: sqlite3.h — SQLITE_PROTOCOL = 15

📖 Further reading: SQLite file locking and concurrency

Confidence assessment

⚠️ MEDIUM confidence

Stable.

See also

📄 Reference pages

SQLite file locking
⚙️ This error reference was generated with AI assistance and reviewed for accuracy. Examples are provided to illustrate common scenarios and may not cover every case. Always test fixes in a development environment before applying to production. Spotted an error? Suggest a correction →