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 sometimes loses the history of open projects and sessions between restarts #14546
This is tricky because I can't tell why and when it happens.
Sometimes when I restart OpenCode and launch the web UI the recently opened projects in the sidebar are blank. If I open a project with cmd+P, then my previous sessions are usually there.
But sometimes they will also be completely blank, and I can't go back to my previous session anymore, forcing me to start from scratch. If that happens, then even going to these sessions by URL won't work.
Plugins
None
OpenCode version
1.2.10
Steps to reproduce
Turn off the server
Launch opencode web
Go to web UI
Verify if previous projects and sessions are there
If your issue is distinct from the above (e.g., it happens after a clean shutdown rather than an unexpected termination, or is specific to the web UI sidebar not reflecting existing sessions), please add a note clarifying the difference so we can track it separately.
I hit this on macOS after a hard restart (MacBook power loss) and was able to diagnose the root cause:
Root cause: SQLite DB and file storage are written at different times
opencode maintains two parallel stores for sessions:
~/.local/share/opencode/opencode.db (SQLite) — written quickly
~/.local/share/opencode/storage/session/<project_id>/<session_id>.json — written later (or lazily flushed)
After a hard crash/restart, the SQLite DB had all sessions intact (including full message history via the message table), but the corresponding .json stub files in the file storage were never written. Since the session list UI appears to be driven by the file storage rather than the DB, those sessions were invisible — even though all data was in SQLite.
Workaround: Reconstruct the missing .json files from the DB:
Fix suggestion: Either make the session list read from SQLite (single source of truth), or ensure the .json file is written atomically before the DB record is committed. The current split-write design creates a durability window where a crash leaves the two stores out of sync.
Activity
github-actions commentedon Feb 21, 2026
This issue might be a duplicate of existing issues. Please check:
If your issue is distinct from the above (e.g., it happens after a clean shutdown rather than an unexpected termination, or is specific to the web UI sidebar not reflecting existing sessions), please add a note clarifying the difference so we can track it separately.
nukeop commentedon Feb 21, 2026
I think this is distinct, because:
isc-tdyar commentedon Feb 22, 2026
I hit this on macOS after a hard restart (MacBook power loss) and was able to diagnose the root cause:
Root cause: SQLite DB and file storage are written at different times
opencode maintains two parallel stores for sessions:
~/.local/share/opencode/opencode.db(SQLite) — written quickly~/.local/share/opencode/storage/session/<project_id>/<session_id>.json— written later (or lazily flushed)After a hard crash/restart, the SQLite DB had all sessions intact (including full message history via the
messagetable), but the corresponding.jsonstub files in the file storage were never written. Since the session list UI appears to be driven by the file storage rather than the DB, those sessions were invisible — even though all data was in SQLite.Workaround: Reconstruct the missing
.jsonfiles from the DB:Fix suggestion: Either make the session list read from SQLite (single source of truth), or ensure the
.jsonfile is written atomically before the DB record is committed. The current split-write design creates a durability window where a crash leaves the two stores out of sync.github-actions commentedon Apr 24, 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.