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
History sessions lost after update - database file changed from opencode.db to opencode-prod.db #21790
After updating opencode today, all my previous conversation history disappeared. The UI shows no sessions from before the update.
Root Cause
The new version switched the database file from opencode.db to opencode-prod.db, but did not migrate existing data:
File
Sessions
Messages
Size
opencode.db (old)
45
2139
27MB
opencode-prod.db (new)
3
13
147KB
The old data is still intact in opencode.db, but the new version only reads from opencode-prod.db.
Expected Behavior
Existing session history should be automatically migrated to the new database file during the upgrade process, or the new version should continue reading from the existing database.
Workaround
Manually merge the old data into the new database:
# Backup first
cp ~/.local/share/opencode/opencode-prod.db ~/.local/share/opencode/opencode-prod.db.bak
# Merge old data (skip duplicates)
sqlite3 ~/.local/share/opencode/opencode-prod.db "ATTACH DATABASE '$HOME/.local/share/opencode/opencode.db' AS old;INSERT OR IGNORE INTO main.project SELECT * FROM old.project;INSERT OR IGNORE INTO main.workspace SELECT * FROM old.workspace;INSERT OR IGNORE INTO main.session SELECT * FROM old.session;INSERT OR IGNORE INTO main.message SELECT * FROM old.message;INSERT OR IGNORE INTO main.part SELECT * FROM old.part;INSERT OR IGNORE INTO main.todo SELECT * FROM old.todo;INSERT OR IGNORE INTO main.session_share SELECT * FROM old.session_share;INSERT OR IGNORE INTO main.permission SELECT * FROM old.permission;INSERT OR IGNORE INTO main.event_sequence SELECT * FROM old.event_sequence;INSERT OR IGNORE INTO main.event SELECT * FROM old.event;DETACH DATABASE old;"
Suggested Fix
Add an automatic migration step on startup: if opencode-prod.db is empty or newly created and opencode.db exists with data, automatically merge all records into the new database.
Activity
github-actions commentedon Apr 10, 2026
This issue might be a duplicate of existing issues. Please check:
opencode.dbbut missing fromopencode-stable.db— same root cause of two separate DB files being out of sync after an update (CLOSED)If your issue is the same as one of these, it may already be addressed or tracked there.
thdxr commentedon Apr 10, 2026
hmm this is weird here is the logic
are you running something that potentially is built differently?
thdxr commentedon Apr 10, 2026
oh wait is this the desktop app? are you using the electron version?
thdxr commentedon Apr 10, 2026
we're fixing this - electron version isn't meant to be used yet sorry about that