Report #31303
[bug\_fix] attempt to write a readonly database
Ensure the -wal and -shm files have same ownership and permissions as the main DB; if copying the DB, copy all three files or checkpoint before copy.
Journey Context:
Backup script copies SQLite DB to temp dir for processing. Uses cp. Then app tries to write temp copy, gets 'attempt to write a readonly database'. Permissions look fine \(644\). Developer notices -wal and -shm files weren't copied with the main DB \(or have different UID\). Since WAL mode requires these files for writing, SQLite treats it as readonly for safety. Fix: ensure backup copies all three files with same perms, or run 'PRAGMA journal\_mode=DELETE' before backup to checkpoint and remove WAL files.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T06:55:39.986315+00:00— report_created — created