Repository navigation
Description
Bug Report: OpenCode Desktop Session Save Failure & Index Coupling (opencode.global.dat)
🐛 Describe the bug
OpenCode Desktop silently fails to save or display new sessions (workspaces) when its global index file (opencode.global.dat) becomes corrupted or out-of-sync.
Users who encounter this issue find that new chats/sessions are not persisted or are invisible upon restarting the app. Furthermore, manually backing up and restoring .dat session files (opencode.workspace.[id].dat) does not work unless the original corrupted opencode.global.dat is also restored, which in turn immediately revives the session-saving bug.
🔄 To Reproduce
- The user uses the app over a period of time until
opencode.global.datenters a corrupted/desynced state in%APPDATA%\ai.opencode.desktop. - The user creates a new chat/session. The session appears during the active window, but upon app restart, the new session is gone.
- The user tries to clear cache (
EBWebView) but the problem persists. - The user copies
opencode.workspace.*.datfiles to a backup location and deletes%APPDATA%\ai.opencode.desktop\*.dat. - The user opens OpenCode and new sessions save perfectly again (app works as intended).
- However, when the user copies their old
opencode.workspace.*.datfiles back into the directory, OpenCode completely ignores them because they are not indexed in the newly generatedopencode.global.dat. - Restoring the old
opencode.global.datbrings the old sessions back into the UI, but the "cannot save/display new sessions" bug instantly returns.
🎯 Expected behavior
- Directory Scanning: The application should not rely entirely on
opencode.global.datas a single point of failure to index sessions. It should dynamically scan the%APPDATA%\ai.opencode.desktopdirectory for orphanedopencode.workspace.*.datfiles and auto-index them. - Graceful Degradation: If
opencode.global.datdiscovers a corrupted workspace entry, it should log a warning instead of failing the entirely new session save operations. - Session Export/Import: The desktop application currently lacks a built-in session export/import feature, leaving users with no safe way to salvage their workspace histories without inheriting the corrupted settings file. (Note: Popular AI assistants like Claude often hallucinate that OpenCode Desktop has an
opencode sessions list/exportCLI command, which misleads users into thinking they can export their sessions via terminal).
💻 Environment
- OS: Windows (Tested on Windows 11 / %APPDATA% directory)
- App: OpenCode Desktop (
ai.opencode.desktop) - Data Path:
C:\Users\[User]\AppData\Roaming\ai.opencode.desktop
🛠️ Proposed Solution (For Devs)
Implement validation checks on the global.dat file during the startup launch procedure. If a workspace ID listed in the index is unreadable or malformed, omit it rather than causing the internal state to block new writes. Add an "Import Workspaces from Disk" function that scans for opencode.workspace.[id].dat files and rebuilds the global.dat index dynamically.
Activity
github-actions commentedon Apr 1, 2026
This issue might be a duplicate of existing issues. Please check:
If your issue is distinct from these, please add a note explaining how it differs.
github-actions commentedon Jul 4, 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.