-
Notifications
You must be signed in to change notification settings - Fork 15k
opentui: fatal: undefined is not an object (evaluating 'agents()[0].name') on startup #14274
Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
Labels
opentuiThis relates to changes in v1.0, now that opencode uses opentuiThis relates to changes in v1.0, now that opencode uses opentui
Description
Description
Running opencode from the terminal crashes immediately on startup with a TypeError in local.tsx:39.
This is different from #7918, which crashes after an auth flow (/connect) at prompt/index.tsx:840. This crash occurs during LocalProvider initialization, triggered by a theme store update (theme.tsx:234 → setStore), before the TUI even renders.
Root cause: agents() returns an empty array during createStore initialization, so agents()[0] is undefined:
// local.tsx:39
const [agentStore, setAgentStore] = createStore<{ current: string }>({
current: agents()[0].name, // agents()[0] is undefined → TypeError
})Stack Trace
TypeError: undefined is not an object (evaluating 'agents()[0].name')
at <anonymous> (src/cli/cmd/tui/context/local.tsx:39:27)
at init (src/cli/cmd/tui/context/local.tsx:35: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 setStore (../../node_modules/.bun/solid-js@1.9.10/node_modules/solid-js/store/dist/dev.js:221:5)
at <anonymous> (src/cli/cmd/tui/context/theme.tsx:234:11)
at processTicksAndRejections (native:7:39)
OpenCode version
1.2.6
Steps to reproduce
- Run
opencodefrom the terminal - TUI crashes immediately on startup
Screenshot and/or share link
No response
Operating System
macOS (Darwin 25.2.0)
Terminal
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
opentuiThis relates to changes in v1.0, now that opencode uses opentuiThis relates to changes in v1.0, now that opencode uses opentui