opencode icon indicating copy to clipboard operation
opencode copied to clipboard

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

Open wei201806 opened this issue 3 months ago • 6 comments

Description

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/.bun/@[email protected]+897ebc1644d3edd0/node_modules/@opentui/solid/index.js:148:62)
    at runComputation (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:742:22)
    at updateComputation (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:724:3)
    at runTop (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:833:7)
    at runUserEffects (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:928:18)
    at runUpdates (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:849:17)
    at completeUpdates (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:900:17)
    at runUpdates (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:850:5)
    at setStore (../../node_modules/.bun/[email protected]/node_modules/solid-js/store/dist/dev.js:221:5)
    at processTicksAndRejections (native:7:39)...

Plugins

No response

OpenCode version

1.1.12

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

wei201806 avatar Jan 11 '26 01:01 wei201806

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

  • #7630: undefined is not an object (evaluating 'local.agent.current().name') - When login copilot
  • #7628: undefined is not an object (evaluating 'local.agent.current().name')
  • #7550: TUI crashes after successful native OpenAI account connection (TypeError: local.agent.current() is undefined)

These issues all share the same error stacktrace at the same line (src/cli/cmd/tui/component/prompt/index.tsx:840:75) and appear to occur after authentication or when the agent becomes undefined.

Feel free to ignore if this doesn't address your specific case.

github-actions[bot] avatar Jan 11 '26 01:01 github-actions[bot]

Can you reproduce the error? And how?

cravenceiling avatar Jan 11 '26 01:01 cravenceiling

Can you reproduce the error? And how?

For me, it happens after the redirection when I connect using the OpenAI provider with a ChatGPT Pro/Plus account under a team subscription. The redirection is what causes the issue.

cgarrot avatar Jan 11 '26 01:01 cgarrot

Can you reproduce the error? And how?

For me, it happens after the redirection when I connect using the OpenAI provider with a ChatGPT Pro/Plus account under a team subscription. The redirection is what causes the issue.

More related issues: When you connect to the OpenAI provider via the tUI with a ChatGPT Pro/Plus account under a team subscription, you get an error. The OpenAI provider appears to be set up, but when you try to use models, you see: ‘Usage not included in your plan’. If you go through the same process using the opencode auth login, it works perfectly.

cgarrot avatar Jan 11 '26 02:01 cgarrot

Opened a PR to fix the TUI crash (local.agent.current().name) that can happen right after OAuth redirect.

PR: https://github.com/anomalyco/opencode/pull/7747

Repro (my case): OpenAI provider login with a ChatGPT Pro/Plus account under a team subscription; crash happens after the redirect.

Note: same stacktrace/line as #7550/#7628/#7630 (prompt/index.tsx:840:75).

cgarrot avatar Jan 11 '26 04:01 cgarrot

Workaround for time being: https://github.com/anomalyco/opencode/issues/7550#issuecomment-3731950685

rekram1-node avatar Jan 11 '26 06:01 rekram1-node

This may be fixed in latest release (going out rn 1.1.14

rekram1-node avatar Jan 12 '26 05:01 rekram1-node

This may be fixed in latest release (going out rn 1.1.14

This is not fixed, same issue on 1.1.14

cgarrot avatar Jan 12 '26 13:01 cgarrot