opentui: TUI crashes after successful native OpenAI account connection (TypeError: local.agent.current() is undefined) #4572

Closed
opened 2026-02-16 17:44:38 -05:00 by yindo · 5 comments
Owner

Originally created by @RovshanMuradov on GitHub (Jan 9, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

Description

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

  1. Launch opencode
  2. Start native OpenAI account connection from the TUI /connect
  3. Complete authentication successfully in the OpenAI browser flow
  4. Return to the opencode TUI

Screenshot and/or share link

Image

Operating System

Arch Linux

Terminal

Ghossty

Originally created by @RovshanMuradov on GitHub (Jan 9, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description # Description 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 ```text 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 1. Launch `opencode` 2. Start native OpenAI account connection from the TUI ```/connect``` 3. Complete authentication successfully in the OpenAI browser flow 4. Return to the opencode TUI ### Screenshot and/or share link <img width="2048" height="1209" alt="Image" src="https://github.com/user-attachments/assets/6d697d6c-143b-4e75-ad3c-1f92ffacfd89" /> ### Operating System Arch Linux ### Terminal Ghossty
yindo added the opentuibug labels 2026-02-16 17:44:38 -05:00
yindo closed this issue 2026-02-16 17:44:38 -05:00
Author
Owner

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

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

  • #5830: opentui crash with 'agents()[0].name' undefined - similar pattern of accessing undefined agent data
  • #4111: opentui crash with 'agents()[0].name' undefined - similar agent initialization issue

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:

  • Crashes occur after some action completes (OpenAI auth in your case, remote attach in #4111)
  • TUI fails when trying to access agent information
  • 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.

@github-actions[bot] commented on GitHub (Jan 9, 2026): This issue might be a duplicate of existing issues. Please check: - #5830: opentui crash with 'agents()[0].name' undefined - similar pattern of accessing undefined agent data - #4111: opentui crash with 'agents()[0].name' undefined - similar agent initialization issue 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: - Crashes occur after some action completes (OpenAI auth in your case, remote attach in #4111) - TUI fails when trying to access agent information - 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.
Author
Owner

@chwdy commented on GitHub (Jan 10, 2026):

exact same issue here

@chwdy commented on GitHub (Jan 10, 2026): exact same issue here
Author
Owner

@chwdy commented on GitHub (Jan 10, 2026):

I found a workaround

  • 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

@chwdy commented on GitHub (Jan 10, 2026): I found a workaround * 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
Author
Owner

@RovshanMuradov commented on GitHub (Jan 10, 2026):

I found a workaround

* 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

Make sense, thank you! I will try

@RovshanMuradov commented on GitHub (Jan 10, 2026): > I found a workaround > > * 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 Make sense, thank you! I will try
Author
Owner

@R44VC0RP commented on GitHub (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.

@R44VC0RP commented on GitHub (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.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4572