SQLITE_READONLY_RECOVERYWARNINGTier 2 — Caution⚠️ MEDIUM confidenceRead-only: WAL recovery required by another connection
🔴 Production Risk Error
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
- 1Database was opened read-only (O_RDONLY) but the WAL needs recovery after a crash.
- 2Read-only replica mount cannot write the -wal file during recovery.
How to reproduce
Read-only database file access with a pending WAL recovery.
import sqlite3
conn = sqlite3.connect('file:my.db?mode=ro', uri=True)
# If WAL recovery needed: SQLITE_READONLY_RECOVERYFix 1
Why this works
Open the database as read-write briefly to allow recovery to complete, then switch back to read-only.
Fix 2
Why this works
Ensure a read-write connection can open the database first to perform WAL recovery.
Sources
📚 Official docs: https://www.sqlite.org/rescode.html#readonly_recovery
🔧 Source ref: sqlite3.h — SQLITE_READONLY_RECOVERY = 264
📖 Further reading: WAL mode
Confidence assessment
⚠️ MEDIUM confidence
Stable.
See also
🔗 Related errors
📄 Reference pages