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
Desktop: switching servers can restore stale session IDs and crash with "Session not found" #25131
OpenCode Desktop appears to persist lastProjectSession / workspace state across different remote servers. After switching servers, it may restore a stale session ID that does not exist on the newly selected server.
When this happens, the UI crashes with Unknown error instead of gracefully returning to project/session selection.
Environment
OpenCode Desktop: 1.14.30
OS: Windows
Setup:
Multiple OpenCode servers
One local or LAN server
One remote server exposed through SSH port forwarding
Error
Error: Unknown error
at castError (http://tauri.localhost/assets/index-Dlz9aEYF.js:1:10383)
at http://tauri.localhost/assets/index-Dlz9aEYF.js:1:3246
Reason:
NotFoundError
Session not found: ses_...
I also saw a related frontend error:
Error: Stale read from <Show>
What seems to be happening
Desktop stores server/workspace/session state under its app data directory.
A persisted lastProjectSession entry may point to a session from a previously selected server. After switching to another server, Desktop attempts to restore that old session ID against the new active server.
If the session does not exist there, the backend returns NotFoundError, and the frontend surfaces it as an unrecoverable Unknown error.
Expected behavior
If a restored session ID is missing on the active server, Desktop should recover gracefully by:
clearing the stale session reference,
returning to the project/workspace view,
or prompting/creating/selecting a valid session.
The UI should not crash.
Server-specific session state should be scoped by server identity, not reused across different servers.
Actual behavior
Desktop repeatedly restores stale session IDs after switching servers and crashes with:
NotFoundError: Session not found: ses_...
Manual cleanup of workspace/session UI state temporarily fixes the issue, but it can recur after switching servers again.
Reproduction outline
Run OpenCode Desktop on Windows.
Configure two different OpenCode servers.
Open a project/session on server A.
Switch to server B where that session ID does not exist.
Desktop attempts to restore the stale session and crashes with Session not found.
Suggested fix
Scope persisted session/workspace state by server URL or stable server ID.
On NotFoundError for a restored session, remove the stale lastProjectSession entry.
Recover to a safe route instead of surfacing a fatal frontend error.
Validate restored session IDs before rendering session-dependent UI.
### Plugins
_No response_
### OpenCode version
v1.14.30
### Steps to reproduce
_No response_
### Screenshot and/or share link
_No response_
### Operating System
windows10
### Terminal
OpenCode Desktop
This issue might be a duplicate of existing issues. Please check:
Multi-server: layout state not namespaced per server causes session loop after switching #18302: Multi-server: layout state not namespaced per server causes session loop after switching — describes the same root cause (lastProjectSession keyed by directory only, not by server origin), same symptom (session not found after switching servers), and even the same proposed fix (namespace by server origin). This appears to be a very close duplicate.
A workaround I have found for this is launch opencode, change the default server to the instance you want to load, then relaunch opencode. It will load your desired server without the stale session IDs.
Activity
github-actions commentedon Apr 30, 2026
This issue might be a duplicate of existing issues. Please check:
lastProjectSessionkeyed by directory only, not by server origin), same symptom (session not found after switching servers), and even the same proposed fix (namespace by server origin). This appears to be a very close duplicate.If this is indeed covered by #18302, consider adding any additional context there rather than tracking it separately.
JtMotoX commentedon May 9, 2026
A workaround I have found for this is launch opencode, change the default server to the instance you want to load, then relaunch opencode. It will load your desired server without the stale session IDs.
github-actions commentedon Jul 9, 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.