Skip to content

Commit 395aede

Browse files
betegonBYK
andauthored
fix(db): handle readonly database gracefully instead of crashing (#235)
## Summary When the CLI's local database (`~/.sentry/cli.db`) is on a read-only filesystem or has wrong permissions, DB writes throw `SQLiteError: attempt to write a readonly database` and crash commands. Now the CLI catches these errors centrally in the traced DB proxy, warns the user once, and continues working — reads still succeed, only caching/persistence is lost. Closes https://sentry.sentry.io/issues/7258516238/ ## Changes Readonly errors are caught in the traced DB proxy (`createTracedStatement`) alongside the existing schema auto-repair logic. A one-time warning prints to stderr pointing users to `sentry cli fix`. This single change protects all ~14 DB write paths without touching individual modules. `sentry cli fix` now also checks file permissions on the DB file, WAL/SHM journals, and config directory — and repairs them with `chmod` when possible. ## Test Plan - `bun run typecheck` — clean - `bun run lint` — clean - 88 tests pass across the 3 changed test files (schema, telemetry, fix command) - New tests: `isReadonlyError()` detection (5 cases), readonly proxy behavior (4 cases: no throw on write, reads work, warns once, message content) --------- Co-authored-by: Burak Yigit Kaya <byk@sentry.io>
1 parent 8aa9cf6 commit 395aede

File tree

6 files changed

+903
-68
lines changed

6 files changed

+903
-68
lines changed

0 commit comments

Comments
 (0)