Skip to content

opentui: fatal: undefined is not an object (evaluating 'local.agent.current().name') #9332

Closed

Description

@jiurang

Description

TypeError: undefined is not an object (evaluating 'local.agent.current().name')
    at <anonymous> (src/cli/cmd/tui/component/prompt/index.tsx:841:75)
    at <anonymous> (../../node_modules/.bun/@opentui+solid@0.1.74+897ebc1644d3edd0/node_modules/@opentui/solid/index.js:148:62)
    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 runTop (../../node_modules/.bun/solid-js@1.9.10/node_modules/solid-js/dist/dev.js:833:7)
    at runUserEffects (../../node_modules/.bun/solid-js@1.9.10/node_modules/solid-js/dist/dev.js:928:18)
    at runUpdates (../../node_modules/.bun/solid-js@1.9.10/node_modules/solid-js/dist/dev.js:849:17)
    at completeUpdates (../../node_modules/.bun/solid-js@1.9.10/node_modules/solid-js/dist/dev.js:900:17)
    at runUpdates (../../node_modules/.bun/solid-js@1.9.10/node_modules/solid-js/dist/dev.js:850:5)
    at setStore (../../node_modules/.bun/solid-js@1.9.10/node_modules/solid-js/store/dist/dev.js:221:5)...

Plugins

No response

OpenCode version

1.1.25

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

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

    @github-actions
    Contributor

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

    Feel free to ignore if none of these address your specific case.

  3. aliyten commented on Jan 19, 2026

    @aliyten

    I also encountered this problem and reported the error as follows:

    Please report an issue. Copy issue URL (exception info pre-filled) Successfully copied

    A fatal error occurred! Reset TUI Exit

    TypeError: undefined is not an object (evaluating 'local.agent.current().name')
    at (src/cli/cmd/tui/component/prompt/index.tsx:841:75)
    at (../../node_modules/.bun/@OpenTui+solid@0.1.74+897ebc1644d3edd0/node_modules/@opentui/solid/index.js:148:62)
    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 runTop (../../node_modules/.bun/solid-js@1.9.10/node_modules/solid-js/dist/dev.js:833:7)
    at runUserEffects (../../node_modules/.bun/solid-js@1.9.10/node_modules/solid-js/dist/dev.js:928:18)
    at runUpdates (../../node_modules/.bun/solid-js@1.9.10/node_modules/solid-js/dist/dev.js:849:17)
    at completeUpdates (../../node_modules/.bun/solid-js@1.9.10/node_modules/solid-js/dist/dev.js:900:17)
    at runUpdates (../../node_modules/.bun/solid-js@1.9.10/node_modules/solid-js/dist/dev.js:850:5)
    at setStore (../../node_modules/.bun/solid-js@1.9.10/node_modules/solid-js/store/dist/dev.js:221:5)
    at processTicksAndRejections (native:7:39)

  4. rekram1-node commented on Jan 21, 2026

    @rekram1-node
    Contributor

    Duplicate of #7918

  5. Skeptomenos commented on Jan 26, 2026

    @Skeptomenos

    Additional data point: oh-my-opencode plugin with disabled agents

    Environment:

    • OpenCode: 1.1.36
    • OS: macOS (darwin)
    • Plugin: oh-my-opencode@latest

    Trigger:

    • Occurs intermittently during regular prompts (not startup)
    • Happens in both new sessions and existing sessions
    • No specific action reproduces it consistently - appears random

    Stack trace:

    TypeError: undefined is not an object (evaluating 'agent.name')
        at createUserMessage (src/session/prompt.ts:832:14)
    

    Relevant config pattern:
    I have oh-my-opencode installed but with all custom agents disabled:

    {
      "agents": {
        "sisyphus": { "disable": true },
        "prometheus": { "disable": true },
        "oracle": { "disable": true },
        "librarian": { "disable": true },
        "explore": { "disable": true },
        "frontend-ui-ux-engineer": { "disable": true },
        "document-writer": { "disable": true },
        "multimodal-looker": { "disable": true },
        "metis": { "disable": true },
        "momus": { "disable": true },
        "atlas": { "disable": true }
      },
      "sisyphus_agent": { "disabled": true }
    }

    Hypothesis:
    The plugin may be registering agent names that get referenced somewhere (session state? internal delegate_task calls?) but since the agents are disabled, Agent.get() returns undefined.

    Missing guard location:
    Looking at the code, src/session/prompt.ts:828 lacks a guard:

    const agent = await Agent.get(input.agent ?? (await Agent.defaultAgent()))
    // No check for undefined before accessing agent.name on line 837

    Compare to other locations that DO have guards:

    • src/tool/task.ts:58 - throws helpful error
    • src/cli/cmd/run.ts:235 - has guard
    • src/cli/cmd/debug/agent.ts:37 - has guard
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