Bug
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)
- Run
opencode
- Observe crash
Environment
- OS: macOS
- opencode: latest dev branch
Bug
When the local SQLite database file becomes corrupted, opencode crashes on startup with:
or:
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
~/.local/share/opencode/opencode.db(e.g. write garbage to internal pages while keeping the SQLite header intact)opencodeEnvironment