You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
opentui: TUI crashes after successful native OpenAI account connection (TypeError: local.agent.current() is undefined) #7550
After connecting my OpenAI account using the native authentication flow, the OpenAI authorization completes successfully in the browser. However, after returning to the opencode TUI, the application crashes with a fatal error and becomes unusable.
Expected behavior
The TUI should continue working normally and show the connected OpenAI account.
Actual behavior
The TUI crashes with a fatal error immediately after authentication completes.
Error output / stack trace
TypeError: undefined is not an object (evaluating 'local.agent.current().name')
at <anonymous> (src/cli/cmd/tui/component/prompt/index.tsx:840:75)
at <anonymous> (.../node_modules/@opentui/solid/index.js:148:62)
at runComputation (.../solid-js/dist/dev.js:742:22)
at updateComputation (.../solid-js/dist/dev.js:724:3)
at runTop (.../solid-js/dist/dev.js:833:7)
at runUserEffects (.../solid-js/dist/dev.js:928:18)
at runUpdates (.../solid-js/dist/dev.js:849:17)
at completeUpdates (.../solid-js/dist/dev.js:900:17)
at setStore (.../solid-js/store/dist/dev.js:221:5)
at processTicksAndRejections (native:7:39)
Environment
OS: Arch Linux
Node.js: (please fill if known)
Bun: 1.3.4
Node.js: v25.2.1
Shell: fish
Additional context
The OpenAI login succeeds (account is authorized on the OpenAI website).
The crash happens only after returning to the TUI.
Workaround: selecting "Reset TUI" fixes the issue.
Screenshot
Plugins
oh-my-opencode
OpenCode version
opencode version: 1.1.11
Steps to reproduce
Launch opencode
Start native OpenAI account connection from the TUI /connect
Complete authentication successfully in the OpenAI browser flow
While the specific error location differs (your issue is at line 840 accessing 'local.agent.current()' vs #5830/#4111 accessing 'agents()[0].name'), the root cause appears to be the same: agent data is not properly initialized or available when the TUI loads/reloads after authentication flows.
Error pattern suggests agent context/store is undefined or not yet loaded
Feel free to ignore if your case is fundamentally different from these, but checking these issues might help identify if this is a broader agent initialization issue in opentui.
* close opencode
* open a new terminal window
* `opencode auth logout` logout openai ( if any)
* `opencode auth login` to login openai
* start opencode, and the provider is properly set up
looks like it's just the ui problem, things behind the ground was working fine
Closing as duplicate of #7918. This is the same root cause - local.agent.current() returns undefined during startup/auth. The tracking issue #7918 has root cause analysis.
Activity
github-actions commentedon Jan 10, 2026
This issue might be a duplicate of existing issues. Please check:
While the specific error location differs (your issue is at line 840 accessing 'local.agent.current()' vs #5830/#4111 accessing 'agents()[0].name'), the root cause appears to be the same: agent data is not properly initialized or available when the TUI loads/reloads after authentication flows.
The common factor is:
Feel free to ignore if your case is fundamentally different from these, but checking these issues might help identify if this is a broader agent initialization issue in opentui.
chwdy commentedon Jan 10, 2026
exact same issue here
chwdy commentedon Jan 10, 2026
I found a workaround
opencode auth logoutlogout openai ( if any)opencode auth loginto login openailooks like it's just the ui problem, things behind the ground was working fine
RovshanMuradov commentedon Jan 10, 2026
Make sense, thank you! I will try
R44VC0RP commentedon Jan 24, 2026
Closing as duplicate of #7918. This is the same root cause -
local.agent.current()returns undefined during startup/auth. The tracking issue #7918 has root cause analysis.