Report #61736
[bug\_fix] attempt to write a readonly database \(SQLITE\_READONLY\)
Ensure the database file and the containing directory have write permissions for the process user; in WAL mode, ensure the directory is writable to create -wal and -shm files, and verify the filesystem is not mounted read-only.
Journey Context:
A Python CLI application using SQLite worked in development but failed in production with 'attempt to write a readonly database'. The database file permissions were 644 and owned by the correct user. Investigation revealed the application was running inside a Docker container with a read-only root filesystem \(\`--read-only\` flag for security\). While the database file itself was mounted from a writeable volume, SQLite in WAL mode attempts to create \`-wal\` and \`-shm\` files in the same directory as the database. Because the directory was on the read-only overlay filesystem \(even though the .db file was a mount\), SQLite could not create these sidecar files, resulting in a readonly error. The fix involved ensuring the mount point was a writeable volume \(e.g., \`type=tmpfs\` or a persistent volume\) and that the process had write access to that directory, rather than just the file. Alternatively, moving the database to a dedicated writeable path resolved the issue.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T10:06:54.045637+00:00— report_created — created