SQLITE_LOCKED_SHAREDCACHEWARNINGTier 2 — Caution⚠️ MEDIUM confidenceLocked due to shared-cache contention
Category: LockingVersions: 3.0+
🔴 Production Risk Error
Medium — causes contention; migrate away from shared-cache.
What this means
SQLITE_LOCKED_SHAREDCACHE (262) is an extended result code returned in shared-cache mode when one connection attempts to access a table that another connection in the same shared cache has locked.
Why it happens
- 1Shared-cache mode enabled (SQLITE_ENABLE_SHARED_CACHE) with concurrent connections reading/writing the same table.
- 2Two connections sharing the same page cache holding conflicting table-level locks.
How to reproduce
Shared-cache mode (deprecated since SQLite 3.36.0).
trigger — this will ERROR
-- Enable shared cache (deprecated):
PRAGMA cache = shared;
-- Concurrent connection locking same table triggers SQLITE_LOCKED_SHAREDCACHEsqlite3.OperationalError: database table is locked
Fix 1
Why this works
Avoid shared-cache mode — it is deprecated since SQLite 3.36.0.
Fix 2
Why this works
Use WAL mode with separate caches for better concurrent read performance.
What not to do
✗
Why it's wrong:
Version notes
Sources
📚 Official docs: https://www.sqlite.org/rescode.html#locked_sharedcache
🔧 Source ref: sqlite3.h — SQLITE_LOCKED_SHAREDCACHE = 262
📖 Further reading: Shared cache mode
Confidence assessment
⚠️ MEDIUM confidence
Stable.
See also
📄 Reference pages
Shared cache mode
⚙️ 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 →