Report #14310
[bug\_fix] attempt to write a readonly database \(SQLITE\_READONLY\)
Check and fix filesystem permissions \(chmod/chown\) on the database file and its containing directory, or remove the immutable flag; if using URI filenames, ensure 'mode=ro' is not set.
Journey Context:
Your CI/CD pipeline deploys a Docker container with a SQLite database copied in. On startup, the app crashes with 'sqlite3.OperationalError: attempt to write a readonly database'. You exec into the container and find the database file is owned by root with mode 644, but the app runs as user 'app'. You try 'chmod 666' on the file, but still get the error. You realize that SQLite also needs write permissions on the containing directory to create the -journal file for atomic commits. You check the directory and it's owned by root with mode 755. The fix is either running 'chown -R app:app /path/to/db' in the Dockerfile, or ensuring the directory is writable by the app user. In another scenario, you might have mounted the volume with the 'ro' \(read-only\) flag, or the file has the immutable attribute \(chattr \+i\), which requires 'chattr -i' to remove. The root cause is always filesystem-level write restrictions preventing SQLite from creating its rollback journal or writing to the main file.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T21:14:51.799141+00:00— report_created — created