You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
opencode crashes on startup when SQLite database is corrupted #37821
When the local SQLite database file becomes corrupted, opencode crashes on startup with:
SQLiteError: database disk image is malformed
or:
SQLiteError: file is not a database
This can happen due to power loss, disk issues, or incomplete writes to the WAL file.
Expected Behavior
opencode should detect corruption, backup the corrupted files, and recreate a fresh database so the user can continue working without manual intervention.
Steps to Reproduce
Corrupt the database file at ~/.local/share/opencode/opencode.db (e.g. write garbage to internal pages while keeping the SQLite header intact)
Confirmed on our side (opencode v1.18.11, Linux, 2026-08-02)
Same crash: opencode aborted natively (SIGABRT, 'core dumped') at startup, silently — no log line, no journal, no apport entry. Every dying instance stopped right after the boot line 'booting location services' (session-list/storage init, where a pathological DB/WAL gets read).
Root cause chain on our machine:
Shared SQLite store (WAL mode) grew to 5.45GB main + 5.48GB WAL because a runaway agent loop wrote unbounded into it (silent retry loop, ~94% CPU, 2h).
New instances opened that DB → native abort at 'booting location services', intermittently, depending on DB state at launch.
This is storage-layer corruption/bloat, not app logic — which is exactly why it was silent: the native abort happens below the JS layer.
A startup recovery path would have prevented the crash entirely: on open of a pathological/oversized DB, checkpoint or rebuild-in-place instead of native abort. #37822 (auto-recover) covers the right direction — hope it ships soon. Happy to attach core data or reproduce on request.
Activity
github-actions commentedon Jul 20, 2026
This issue might be a duplicate of existing issues. Please check:
B67687 commentedon Aug 3, 2026
Confirmed on our side (opencode v1.18.11, Linux, 2026-08-02)
Same crash: opencode aborted natively (SIGABRT, 'core dumped') at startup, silently — no log line, no journal, no apport entry. Every dying instance stopped right after the boot line 'booting location services' (session-list/storage init, where a pathological DB/WAL gets read).
Root cause chain on our machine:
This is storage-layer corruption/bloat, not app logic — which is exactly why it was silent: the native abort happens below the JS layer.
What fixed it for us
PRAGMA wal_checkpoint(TRUNCATE)+VACUUM(reclaimed ~1.7GB freelist, page_count 1,330,391 → compacted) + killed the runaway writer. DB 3.6GB, integrity ok, WAL 4KB, boot clean.Request
A startup recovery path would have prevented the crash entirely: on open of a pathological/oversized DB, checkpoint or rebuild-in-place instead of native abort. #37822 (auto-recover) covers the right direction — hope it ships soon. Happy to attach core data or reproduce on request.
github-actions commentedon Oct 3, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.