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
Windows Desktop loses all session history after restart, but sessions still exist in opencode.db #17765
Description
On Windows Desktop, all session history disappears every time I close and reopen OpenCode.
This is not just a UI refresh issue. After reopening the client, the session list is completely empty.
However, I checked the local database and confirmed that the sessions are still stored locally, so the data does not appear to be deleted. This looks like a session loading / project matching / indexing bug on startup.
Environment
OpenCode version: 1.2.27
OS: Windows
Client: Desktop
Workspace type: local Windows directory
Path usage: fixed / consistent path, not switching between different path formats
WSL: not using WSL for this case
Steps to reproduce
Open OpenCode Desktop on Windows
Open a local project directory
Create or use some sessions normally
Close OpenCode Desktop
Reopen OpenCode Desktop
Observe that the session history list is now empty
Expected behavior
Previously created sessions should still appear in the session/history list after reopening the app.
Actual behavior
After reopening the app, the session/history list is completely empty.
Important local findings
I inspected the local database at:
session table exists and contains records
message table exists and contains records
storage/session_diff/ also contains files matching the session IDs
But the data shape looks suspicious:
the only row in project is:
id = global
worktree = /
all session rows have:
project_id = global
directory = D:
So the persisted session data is still there, but the project/worktree mapping looks inconsistent on Windows:
project.worktree = "/"
while session.directory = "D:"
This makes me suspect that after restart, Desktop cannot match/load the existing sessions correctly, so the UI shows an empty list even though the data still exists.
Additional notes
This is on a local Windows directory
I am not changing paths
I already updated to the latest version available to me (1.2.27)
The problem happens consistently after closing and reopening the client
Possible root cause
This may be related to Windows-specific path normalization / project matching / session indexing on startup.
Your investigation pointing to project.worktree = "/" vs session.directory = "D:\\" matches the root cause documented in #16579. It may be worth checking if those fixes address your scenario as well.
it looks like i have the same problem on linux with the terminal user interface of opencode. But it also looked like when i use the continue command like 'opencode -s ses_2fe99f6daffe9531Hu62OH7JoN' than its propably able to find the old version and load it (im not so sure if was in the sessions overfiew before but i would say no
I hit this on Windows Desktop connected to a WSL-backed server. Sessions were still being written, but the same repo could end up identified as both /home/... and \wsl.localhost... so the sidebar hid them. I opened PR #22049 with a small fix that normalizes WSL UNC-style paths both when comparing sidebar workspace keys and when saving new session directories.
Good day. Well i am not sure if this is a feature or a bug. I am on version OpenCode Desktop
v1.14.46. After i am done for the day, all chats and the entire session is missing after i close the application and open it. I have checked the %localappdata% for the session .json file. All of them are at 1Kb wit only [] in them. there is no chats noting.
This may be related to the way Opencode stores sessions and Mapped Drive letters. If you experience this behavior, and are using a mapped drive, open your project with the full UNC path instead.
+1 — I'm experiencing the same issue on Windows 10 with OpenCode Desktop v1.15.12.
Environment:
OS: Windows 10
OpenCode Desktop version: 1.15.12
No WSL
Behavior:
Sessions are created and stored in the database (opencode.db)
After restarting Desktop, the session list is completely empty
However, sessions are accessible via CLI: opencode session list shows all 30+ sessions
Database verification:
Sessions exist in %USERPROFILE%.local\share\opencode\opencode.db
The project.worktree value shows / while session.directory shows the correct Windows path (e.g., D:)
Workaround: Using the CLI (opencode -c or opencode -s ) works correctly and loads sessions as expected.
This confirms the project/worktree mapping issue on Windows. Looking forward to a fix!
Activity
github-actions commentedon Mar 16, 2026
This issue might be a duplicate of existing issues. Please check:
project.worktree = "/"whilesession.directoryholds the real Windows pathYour investigation pointing to
project.worktree = "/"vssession.directory = "D:\\"matches the root cause documented in #16579. It may be worth checking if those fixes address your scenario as well.Xyz00777 commentedon Mar 26, 2026
it looks like i have the same problem on linux with the terminal user interface of opencode. But it also looked like when i use the continue command like 'opencode -s ses_2fe99f6daffe9531Hu62OH7JoN' than its propably able to find the old version and load it (im not so sure if was in the sessions overfiew before but i would say no
paulcatamio commentedon Apr 11, 2026
I hit this on Windows Desktop connected to a WSL-backed server. Sessions were still being written, but the same repo could end up identified as both /home/... and \wsl.localhost... so the sidebar hid them. I opened PR #22049 with a small fix that normalizes WSL UNC-style paths both when comparing sidebar workspace keys and when saving new session directories.
TrekkerTyre commentedon May 10, 2026
Good day. Well i am not sure if this is a feature or a bug. I am on version OpenCode Desktop
v1.14.46. After i am done for the day, all chats and the entire session is missing after i close the application and open it. I have checked the %localappdata% for the session .json file. All of them are at 1Kb wit only [] in them. there is no chats noting.
quintalis2 commentedon May 19, 2026
This may be related to the way Opencode stores sessions and Mapped Drive letters. If you experience this behavior, and are using a mapped drive, open your project with the full UNC path instead.
StevenTorval commentedon May 29, 2026
+1 — I'm experiencing the same issue on Windows 10 with OpenCode Desktop v1.15.12.
Environment:
OS: Windows 10
OpenCode Desktop version: 1.15.12
No WSL
Behavior:
Sessions are created and stored in the database (opencode.db)
After restarting Desktop, the session list is completely empty
However, sessions are accessible via CLI: opencode session list shows all 30+ sessions
Database verification:
Sessions exist in %USERPROFILE%.local\share\opencode\opencode.db
The project.worktree value shows / while session.directory shows the correct Windows path (e.g., D:)
Workaround: Using the CLI (opencode -c or opencode -s ) works correctly and loads sessions as expected.
This confirms the project/worktree mapping issue on Windows. Looking forward to a fix!
TrekkerTyre commentedon May 30, 2026
Well i had found a work around this. I just create a new project and that is how i got open code to save the chat and progress.
github-actions commentedon Jul 30, 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.