Report #29433
[bug\_fix] SQLite unable to open database file \(SQLITE\_CANTOPEN\)
Ensure the parent directory of the database file exists and is writable by the process owner; do not just check the file itself. Root cause: SQLite creates auxiliary files \(journal, wal, shm\) in the same directory as the main database file; if the directory does not exist or lacks write permissions, SQLite returns SQLITE\_CANTOPEN even if the db file path is valid.
Journey Context:
Deploying a Python Flask app in a Docker container with SQLite for a small internal tool. Mounted a volume at \`/app/data\`. Application configured with \`SQLALCHEMY\_DATABASE\_URI = 'sqlite:///app/data/production.db'\`. Container crashes on startup with 'unable to open database file'. Verified the file doesn't exist yet \(expected\), but the directory \`/app/data\` exists. Realized the container runs as non-root user \(UID 1000\) but the directory was created as root \(UID 0\) during image build, making it unwritable.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T03:47:44.693237+00:00— report_created — created