SQLITE_READONLY_RECOVERY
SQLiteWARNINGNotableRead-Onlyofficial confidence

Read-only: WAL recovery required by another connection

Production Risk

High — read-only connections cannot access the database until recovery completes.

What this means

SQLITE_READONLY_RECOVERY (264) is returned when a read-only connection attempts to open a WAL-mode database that requires WAL recovery (crash recovery), but because the connection is read-only it cannot perform the recovery.

Why it happens
  1. 1Database was opened read-only (O_RDONLY) but the WAL needs recovery after a crash.
  2. 2Read-only replica mount cannot write the -wal file during recovery.
How to reproduce

Read-only database file access with a pending WAL recovery.

trigger — this will error
trigger — this will error
import sqlite3
conn = sqlite3.connect('file:my.db?mode=ro', uri=True)
# If WAL recovery needed: SQLITE_READONLY_RECOVERY

expected output

sqlite3.OperationalError: attempt to write a readonly database

Fix 1

Fix 2

Sources
Official documentation ↗

sqlite3.h — SQLITE_READONLY_RECOVERY = 264

WAL mode

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All SQLite errors