opentui: fatal: undefined is not an object (evaluating 'agents()[0].name') #3684

Closed
opened 2026-02-16 17:41:05 -05:00 by yindo · 4 comments
Owner

Originally created by @tsopito on GitHub (Dec 20, 2025).

Originally assigned to: @rekram1-node on GitHub.

Description

TypeError: undefined is not an object (evaluating 'agents()[0].name')
    at <anonymous> (src/cli/cmd/tui/context/local.tsx:53:27)
    at init (src/cli/cmd/tui/context/local.tsx:50:19)
    at provider (src/cli/cmd/tui/context/helper.tsx:8:26)
    at untrack (../../node_modules/.bun/solid-js@1.9.10/node_modules/solid-js/dist/dev.js:475:12)
    at runComputation (../../node_modules/.bun/solid-js@1.9.10/node_modules/solid-js/dist/dev.js:742:22)
    at updateComputation (../../node_modules/.bun/solid-js@1.9.10/node_modules/solid-js/dist/dev.js:724:3)
    at devComponent (../../node_modules/.bun/solid-js@1.9.10/node_modules/solid-js/dist/dev.js:593:3)
    at children (src/cli/cmd/tui/context/helper.tsx:18:24)
    at <anonymous> (../../node_modules/.bun/solid-js@1.9.10/node_modules/solid-js/dist/dev.js:1057:29)
    at runComputation (../../node_modules/.bun/solid-js@1.9.10/node_modules/solid-js/dist/dev.js:742:22)...

OpenCode version

1.0.174

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Originally created by @tsopito on GitHub (Dec 20, 2025). Originally assigned to: @rekram1-node on GitHub. ### Description ``` TypeError: undefined is not an object (evaluating 'agents()[0].name') at <anonymous> (src/cli/cmd/tui/context/local.tsx:53:27) at init (src/cli/cmd/tui/context/local.tsx:50:19) at provider (src/cli/cmd/tui/context/helper.tsx:8:26) at untrack (../../node_modules/.bun/solid-js@1.9.10/node_modules/solid-js/dist/dev.js:475:12) at runComputation (../../node_modules/.bun/solid-js@1.9.10/node_modules/solid-js/dist/dev.js:742:22) at updateComputation (../../node_modules/.bun/solid-js@1.9.10/node_modules/solid-js/dist/dev.js:724:3) at devComponent (../../node_modules/.bun/solid-js@1.9.10/node_modules/solid-js/dist/dev.js:593:3) at children (src/cli/cmd/tui/context/helper.tsx:18:24) at <anonymous> (../../node_modules/.bun/solid-js@1.9.10/node_modules/solid-js/dist/dev.js:1057:29) at runComputation (../../node_modules/.bun/solid-js@1.9.10/node_modules/solid-js/dist/dev.js:742:22)... ``` ### OpenCode version 1.0.174 ### Steps to reproduce _No response_ ### Screenshot and/or share link _No response_ ### Operating System _No response_ ### Terminal _No response_
yindo added the opentuibug labels 2026-02-16 17:41:05 -05:00
yindo closed this issue 2026-02-16 17:41:05 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Dec 20, 2025):

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

  • #4111: opentui: fatal: undefined is not an object (evaluating 'agents()[0].name') - Same error, occurs when connecting to remote OpenCode headless server
  • #4578: OpenCode GitHub Actions can't work with disabled default agents - Related issue where the error occurs when default agents are disabled

Both issues suggest that the problem is in src/cli/cmd/tui/context/local.tsx where agents()[0].name is accessed without checking if agents array is empty or defined. This happens when no agents are available to the current session.

Feel free to ignore if your specific case is different from these scenarios (e.g., remote connection or disabled agents).

@github-actions[bot] commented on GitHub (Dec 20, 2025): This issue might be a duplicate of existing issues. Please check: - #4111: opentui: fatal: undefined is not an object (evaluating 'agents()[0].name') - Same error, occurs when connecting to remote OpenCode headless server - #4578: OpenCode GitHub Actions can't work with disabled default agents - Related issue where the error occurs when default agents are disabled Both issues suggest that the problem is in `src/cli/cmd/tui/context/local.tsx` where `agents()[0].name` is accessed without checking if agents array is empty or defined. This happens when no agents are available to the current session. Feel free to ignore if your specific case is different from these scenarios (e.g., remote connection or disabled agents).
Author
Owner

@rekram1-node commented on GitHub (Dec 20, 2025):

@tsopito can u share:

opencode debug config

@rekram1-node commented on GitHub (Dec 20, 2025): @tsopito can u share: `opencode debug config`
Author
Owner

@rekram1-node commented on GitHub (Dec 20, 2025):

It looks like all ur primary agents are disabled, Ill adjust the code so we have cleaner error for this but this is a config issue on ur end

@rekram1-node commented on GitHub (Dec 20, 2025): It looks like all ur primary agents are disabled, Ill adjust the code so we have cleaner error for this but this is a config issue on ur end
Author
Owner

@rekram1-node commented on GitHub (Dec 20, 2025):

Should fix it (as in better error):
https://github.com/sst/opencode/commit/d61b04acad16e9d5a3e0d63e4a066ad6b15c33ba

@rekram1-node commented on GitHub (Dec 20, 2025): Should fix it (as in better error): https://github.com/sst/opencode/commit/d61b04acad16e9d5a3e0d63e4a066ad6b15c33ba
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3684