Skip to content

Session-not-found errors are only detected in the exact V1 shape, other wrappers are missed #48012

Closed as not planned

Description

@CannonRS

Description

isSessionNotFoundError / isLocalSessionNotFoundError in the app only recognise the exact V1 tagged shape (_tag === "SessionNotFoundError" with matching sessionID) and the exact local Error.message. When the server returns session-deletion errors through other wrappers — a plain string body, an object with name: "NotFoundError" and data.message, or any serialised object whose message contains the not-found text — the detector misses it, so UI code that should treat the session as gone (hide the entry, stop retrying, drop references) instead keeps it or shows a generic failure.

Plugins

N/A

OpenCode version

dev (current upstream/dev)

Steps to reproduce

  1. Open a session, then delete it on the server (or let a worker remove it).
  2. Trigger a request against the deleted session (rename, load, switch).
  3. The error arrives shaped as a string "Session not found: <id>" or as a NotFoundError object. isSessionNotFoundError returns false, so the app does not route to the "session gone" handling and surfaces a generic error.

Screenshot and/or share link

N/A

Operating System

Windows 11 (platform-independent)

Terminal

N/A (app UI / desktop)

Related / duplicate check

  • No open issue matches this specific error-shape detection gap; verified by search.

Activity

  1. github-actions commented on Sep 8, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your issue is specifically about the isSessionNotFoundError / isLocalSessionNotFoundError detection functions missing non-V1 error shapes (plain string, NotFoundError object, etc.), it may be distinct from the above. Please cross-reference and close or link as appropriate.

  2. CannonRS commented on Sep 8, 2026

    @CannonRS
    Author

    These related issues describe observable symptoms of a session going away (renderer crash on a stale lastProjectSession pointer, unhandled rejection bursts from stale subagent sessions, survivor references). This issue is narrower and distinct: it targets the two detection predicates (isSessionNotFoundError / isLocalSessionNotFoundError) that decide whether an incoming error is a not-found shape at all. Fixing the predicates makes all three symptom paths route correctly through the existing "session gone" handling instead of treating the error as generic.

    Cross-reference: the mQorva fork has a related fix for the survivor-reference path (#47683 / stale-session-references); this issue covers the shared predicate that both that fix and the crash/overlay paths depend on.

  3. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for the detailed write-up!

    On current dev, the server converts a missing session into a tagged SessionNotFoundError ({ _tag: "SessionNotFoundError", sessionID, message }) in packages/server/src/handlers/session-error.ts, and isSessionNotFoundError in the app matches that shape. I couldn't find a v2 server path that returns name: "NotFoundError" with data.message; that looks like the v1 error format. To check whether there's a real gap, could you share:

    • The exact action and request that failed (for example rename, load or switch, and which endpoint it calls, if you know).
    • The raw error the app received: the response body and status from the network tab or the server logs, or the error value reaching isSessionNotFoundError.
    • The output of opencode --version for the server you were connected to, and how it was started (desktop app, opencode serve, etc.).

    You can reply here with the details, or edit the issue. If you edit it, please also leave a comment saying you've updated it so we know you're done.

  4. opencodejr commented on Oct 31, 2026

    @opencodejr
    Contributor

    Closing this for now, since we haven't heard back. To tell whether isSessionNotFoundError really misses a case, we'd need to see a v2 server send a session-not-found error in a shape the check doesn't recognise. The server code on dev always sends the tagged SessionNotFoundError, and the check matches that.

    If you see this happen, please comment here or open a new issue with:

    • the action or request that failed
    • the raw response body and status, or the error value the app received
    • your opencode --version

    We'll be happy to take another look. Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions