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 }}
Repository navigation
opencode crashes on start with SQLITE_CORRUPT #30157
I can't use opencode anymore. Startup crashes. Logs:
INFO 2026-06-01T02:02:56 +115ms service=default version=1.15.13 args=["debug","info"] process_role=main run_id=02f6fe66-d0c0-4120-aff3-f795c72b4717 opencode
INFO 2026-06-01T02:02:56 +4ms service=file init
INFO 2026-06-01T02:02:56 +250ms service=db path=/Users/myuser/.local/share/opencode/opencode.db opening database
ERROR 2026-06-01T02:02:56 +3ms service=default cause={"_id":"Cause","failures":[{"_tag":"Die","defect":{"name":"DrizzleError","cause":{"code":"SQLITE_CORRUPT","errno":11,"byteOffset":-1}}}]} failed to run data migrations
INFO 2026-06-01T02:02:56 +14ms service=default directory=/Users/myuser/.config/opencode creating instance
INFO 2026-06-01T02:02:56 +0ms service=project directory=/Users/myuser/.config/opencode fromDirectory
INFO 2026-06-01T02:02:56 +2ms service=db path=/Users/myuser/.local/share/opencode/opencode.db opening database
terminal output
~/.config/opencode via v24.14.1
❯ opencode
Error: 4 of 5 requests failed: Unexpected server error. Check server logs for details.
Affected startup requests: config.providers, provider.list, app.agents, config.get
at sO (/$bunfs/root/chunk-7kbvbz65.js:468:117)
at <anonymous> (/$bunfs/root/chunk-7kbvbz65.js:468:5550)
at processTicksAndRejections (native:7:39)
~/.config/opencode via v24.14.1
❯ opencode debug info
Error: Unexpected error, check log file at /Users/myuser/.local/share/opencode/log/2026-06-01T020256.log for more details
Failed to run the query 'PRAGMA journal_mode = WAL'
If your issue is specifically caused by a corrupted database file, you may be able to resolve it by removing or renaming ~/.local/share/opencode/opencode.db and restarting opencode (note: this will clear your session history).
FWIW, this happened around the time I was messing around with mounting my opencode config dir into a Docker container locally. So there's a good chance this is due to a SQLite file-locking failure.
I fixed this by deleting the opencode database and letting opencode recreate it rm ~/.local/share/opencode/opencode.db
~/.config/opencode via v24.14.1
❯ rm ~/.local/share/opencode/opencode.db
~/.config/opencode via v24.14.1
❯ opencode
Performing one time database migration, may take a few minutes...
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 100% todos 2494/2494
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 100% complete 2494/2494
Database migration complete.
Activity
github-actions commentedon Jun 1, 2026
This issue might be a duplicate of existing issues. Please check:
If your issue is specifically caused by a corrupted database file, you may be able to resolve it by removing or renaming
~/.local/share/opencode/opencode.dband restarting opencode (note: this will clear your session history).flexdinesh commentedon Jun 1, 2026
FWIW, this happened around the time I was messing around with mounting my opencode config dir into a Docker container locally. So there's a good chance this is due to a SQLite file-locking failure.
flexdinesh commentedon Jun 1, 2026
I fixed this by deleting the opencode database and letting opencode recreate it
rm ~/.local/share/opencode/opencode.dbbapijun commentedon Jul 14, 2026
rm ~/.local/share/opencode/opencode.db
is great idea.
I'm guessing it's because I failed to update OpenCode.