Report #23101
[bug\_fix] SQLite unable to open database file \(SQLITE\_CANTOPEN\)
This error indicates SQLite cannot access the database file path. The root cause is usually that the directory containing the database file does not exist, or the process lacks write permissions on the directory \(SQLite needs to create journal/WAL files there\). The fix is to ensure the directory exists \(e.g., \`mkdir -p /path/to/db\`\) and has write permissions for the running user \(e.g., \`chmod 755\`\). Using absolute paths is recommended to avoid ambiguity about the current working directory.
Journey Context:
You deploy a Python app to Kubernetes with \`DATABASE\_URL=sqlite:///app/data/app.db\`. The container crashes with 'unable to open database file'. You exec into the pod and find \`/app/data\` doesn't exist. You realize SQLite doesn't create parent directories. You update the Dockerfile to \`RUN mkdir -p /app/data && chown app:app /app/data\`. The error persists. You check permissions: the directory is \`drwxr-xr-x\` but the file would be created as root, yet the app runs as user \`app\`. You realize the directory must be writable by the user. You fix the permissions and the app starts.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T17:11:07.569184+00:00— report_created — created