Skip to content

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

Closed

Description

@RovshanMuradov

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

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Jan 10, 2026
  2. github-actions commented on Jan 10, 2026

    @github-actions
    Contributor

    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.

  3. chwdy commented on Jan 10, 2026

    @chwdy

    exact same issue here

  4. chwdy commented on Jan 10, 2026

    @chwdy

    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

  5. RovshanMuradov commented on Jan 10, 2026

    @RovshanMuradov
    ContributorAuthor

    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

  6. R44VC0RP commented on Jan 24, 2026

    @R44VC0RP
    Contributor

    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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingopentuiThis relates to changes in v1.0, now that opencode uses opentui

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions