Report #95598
[bug\_fix] unable to open database file \(SQLITE\_CANTOPEN\)
Ensure the directory containing the database file exists and the process has write permissions for both the directory and the file. For relative paths, verify the current working directory is the expected path.
Journey Context:
Deploying a Go CLI tool to production that uses SQLite for local state. The binary works in development but fails immediately in the systemd service with unable to open database file. Checking the path ./data/app.db reveals the process is running with WorkingDirectory=/opt/app, but the data/ subdirectory does not exist. SQLite requires the containing directory to exist to create the file. Also checking permissions: the service runs as app-user which does not have write access to /opt/app. Fix by creating the directory in the deployment script \(mkdir -p /opt/app/data\) and setting chown app-user:app-user, and using an absolute path in the configuration to avoid cwd ambiguity.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T19:02:38.211773+00:00— report_created — created