Skip to content

TUI crashes with 'undefined is not an object' when continuing session via -s flag #6887

Closed as not planned

Description

@jeremyssocial

Bug Description

Running opencode -s <session_id> crashes with:

TypeError: undefined is not an object (evaluating 'session().parentID')

Reproduction Steps

  1. List sessions: opencode session (or via session_list API)
  2. Pick a valid session ID
  3. Run: opencode -s ses_4749abd4effe7hNsT4YSvK3ZgJ
  4. TUI crashes immediately

Root Cause

The console shows the actual error before the crash:

[LOG] 'navigate' { type: 'session', sessionID: 'ses_4749abd4effe7hNsT4YSvK3ZgJ' }
[ERROR] Error: Unexpected end of JSON input
    SyntaxError: Unexpected end of JSON input
        at <parse> (:0)
        at json (unknown)
        at <anonymous> (../sdk/js/src/v2/gen/client/client.gen.ts:167:33)

The session.get API call returns an empty/malformed JSON response, causing JSON.parse to fail. The TUI then tries to render with session() === undefined, crashes on session().parentID access.

Expected Behavior

Should either:

  1. Return valid JSON from the session.get API
  2. Gracefully handle the error and show "Session not found" message

Environment

  • opencode version: 1.1.1
  • OS: macOS (darwin arm64)

Additional Context

The session DOES exist in the database (verified via session_info API which returns metadata correctly). The issue appears to be in the HTTP API layer or JSON serialization.

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Jan 5, 2026
  2. jeremyssocial commented on Jan 5, 2026

    @jeremyssocial
    Author

    Closing - this appears to be a local configuration/plugin issue, not a general bug. Apologies for the noise.

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

Metadata

Metadata

Assignees

Labels

opentuiThis relates to changes in v1.0, now that opencode uses opentui

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions