opentui: fatal: undefined is not an object (evaluating 'session().parentID') #4244

Closed
opened 2026-02-16 17:43:09 -05:00 by yindo · 3 comments
Owner

Originally created by @sureshsankaran on GitHub (Jan 5, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

When attempting to fork a new session from a past interaction, OpenCode TUI throws a fatal error.

Error

Error: undefined is not an object (evaluating 'session().parentID')
    at <anonymous> (/Users/suressan/github_manager/repos/opencode/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx:82:17)
    at runComputation (/Users/suressan/github_manager/repos/opencode/node_modules/solid-js/dist/solid.js:695:22)
    at updateComputation (/Users/suressan/github_manager/repos/opencode/node_modules/solid-js/dist/solid.js:677:3)
    at runTop (/Users/suressan/github_manager/repos/opencode/node_modules/solid-js/dist/solid.js:784:7)
    at runQueue (/Users/suressan/github_manager/repos/opencode/node_modules/solid-js/dist/solid.js:855:42)
    at completeUpdates (/Users/suressan/github_manager/repos/opencode/node_modules/solid-js/dist/solid.js:811:84)
    at runUpdates (/Users/suressan/github_manager/repos/opencode/node_modules/solid-js/dist/solid.js:801:5)
    at setStore (/Users/suressan/github_manager/repos/opencode/node_modules/solid-js/store/dist/store.js:210:5)
    at navigate (/Users/suressan/github_manager/repos/opencode/packages/opencode/src/cli/cmd/tui/routes/session/context/route.tsx:18:9)
    at <anonymous> (/Users/suressan/github_manager/repos/opencode/packages/opencode/src/cli/cmd/tui/routes/session/dialog-message.tsx:83:15)
    at processTicksAndRejections (native)

Steps to Reproduce

  1. Open an existing session from history
  2. Attempt to fork the session to create a new one
  3. Fatal error occurs

Root Cause Analysis

Line 119 in routes/session/index.tsx uses session().parentID without null-checking:

if (session().parentID) return sync.data.permission[route.sessionID] ?? []

Other lines in the same file correctly use optional chaining: session()?.parentID

The session object is undefined when the forked/parent session data hasn't loaded into the sync store yet.

Suggested Fix

// Line 119: Change from:
if (session().parentID) return sync.data.permission[route.sessionID] ?? []
// To:
if (session()?.parentID) return sync.data.permission[route.sessionID] ?? []

Environment

  • OpenCode version: local (built from source)
  • Platform: macOS (darwin)
Originally created by @sureshsankaran on GitHub (Jan 5, 2026). Originally assigned to: @rekram1-node on GitHub. ## Description When attempting to fork a new session from a past interaction, OpenCode TUI throws a fatal error. ## Error ``` Error: undefined is not an object (evaluating 'session().parentID') at <anonymous> (/Users/suressan/github_manager/repos/opencode/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx:82:17) at runComputation (/Users/suressan/github_manager/repos/opencode/node_modules/solid-js/dist/solid.js:695:22) at updateComputation (/Users/suressan/github_manager/repos/opencode/node_modules/solid-js/dist/solid.js:677:3) at runTop (/Users/suressan/github_manager/repos/opencode/node_modules/solid-js/dist/solid.js:784:7) at runQueue (/Users/suressan/github_manager/repos/opencode/node_modules/solid-js/dist/solid.js:855:42) at completeUpdates (/Users/suressan/github_manager/repos/opencode/node_modules/solid-js/dist/solid.js:811:84) at runUpdates (/Users/suressan/github_manager/repos/opencode/node_modules/solid-js/dist/solid.js:801:5) at setStore (/Users/suressan/github_manager/repos/opencode/node_modules/solid-js/store/dist/store.js:210:5) at navigate (/Users/suressan/github_manager/repos/opencode/packages/opencode/src/cli/cmd/tui/routes/session/context/route.tsx:18:9) at <anonymous> (/Users/suressan/github_manager/repos/opencode/packages/opencode/src/cli/cmd/tui/routes/session/dialog-message.tsx:83:15) at processTicksAndRejections (native) ``` ## Steps to Reproduce 1. Open an existing session from history 2. Attempt to fork the session to create a new one 3. Fatal error occurs ## Root Cause Analysis Line 119 in `routes/session/index.tsx` uses `session().parentID` without null-checking: ```typescript if (session().parentID) return sync.data.permission[route.sessionID] ?? [] ``` Other lines in the same file correctly use optional chaining: `session()?.parentID` The session object is `undefined` when the forked/parent session data hasn't loaded into the sync store yet. ## Suggested Fix ```typescript // Line 119: Change from: if (session().parentID) return sync.data.permission[route.sessionID] ?? [] // To: if (session()?.parentID) return sync.data.permission[route.sessionID] ?? [] ``` ## Environment - OpenCode version: local (built from source) - Platform: macOS (darwin)
yindo added the opentui label 2026-02-16 17:43:09 -05:00
yindo closed this issue 2026-02-16 17:43:09 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 5, 2026):

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

  • #6867: Similar 'session().parentID' error occurring in v1.1.1
  • #6874: Regression in opencode attach command with identical error message and suggested fix

All three issues report the same root cause - missing optional chaining on session().parentID in routes/session/index.tsx. Feel free to ignore if your specific case differs from these.

@github-actions[bot] commented on GitHub (Jan 5, 2026): This issue might be a duplicate of existing issues. Please check: - #6867: Similar 'session().parentID' error occurring in v1.1.1 - #6874: Regression in opencode attach command with identical error message and suggested fix All three issues report the same root cause - missing optional chaining on session().parentID in routes/session/index.tsx. Feel free to ignore if your specific case differs from these.
Author
Owner

@rekram1-node commented on GitHub (Jan 5, 2026):

what version r u on i thought we fixed this?

@rekram1-node commented on GitHub (Jan 5, 2026): what version r u on i thought we fixed this?
Author
Owner

@R44VC0RP commented on GitHub (Jan 24, 2026):

Closing as duplicate of #6977 - same session().parentID undefined error.

@R44VC0RP commented on GitHub (Jan 24, 2026): Closing as duplicate of #6977 - same `session().parentID` undefined error.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4244