// SQLite error reference

SQLITE_LOCKED_SHAREDCACHE: record locked in shared cache

In shared-cache mode, another connection sharing the same cache is modifying the data this connection needs, so access is blocked.

Result code
SQLITE_LOCKED_SHAREDCACHE
Name
262
Category
Extended result codes
Error message
database table is locked

What it means

SQLITE_LOCKED_SHAREDCACHE (262) only occurs in shared-cache mode, where several connections in one process share a page cache. While one of them is modifying a record, the others are blocked from it so they never see a half-finished change.

Common causes

  • Opening connections with cache=shared (often an in-memory database shared between connections) and writing from one while reading from another.

How to fix it

  1. Prefer separate caches with WAL mode for concurrency; SQLite discourages shared-cache mode for most uses.

    PRAGMA journal_mode = WAL;
  2. If you need shared cache, coordinate access in the application, or use sqlite3_unlock_notify() to wait for the lock to be released.

Related errors

More extended result codes errors

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.

// fewer errors, faster fixes

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.