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

Closed
opened 2026-02-16 17:43:00 -05:00 by yindo · 1 comment
Owner

Originally created by @jeremyssocial on GitHub (Jan 4, 2026).

Originally assigned to: @rekram1-node on GitHub.

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.

Originally created by @jeremyssocial on GitHub (Jan 4, 2026). Originally assigned to: @rekram1-node on GitHub. ## 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.
yindo added the opentui label 2026-02-16 17:43:00 -05:00
yindo closed this issue 2026-02-16 17:43:00 -05:00
Author
Owner

@jeremyssocial commented on GitHub (Jan 4, 2026):

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

@jeremyssocial commented on GitHub (Jan 4, 2026): Closing - this appears to be a local configuration/plugin issue, not a general bug. Apologies for the noise.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4198