Skip to content

Crash when local.agent.current() returns undefined during startup/auth #7918

@tdawe1

Description

@tdawe1

Description

OpenCode crashes with TypeError: undefined is not an object when:

  1. Using authentication plugins like opencode-antigravity-auth
  2. The agents array is empty or not yet loaded during startup

Stack Traces

TypeError: undefined is not an object (evaluating 'local.agent.current().name') at (src/cli/cmd/tui/component/prompt/index.tsx:840)

TypeError: undefined is not an object (evaluating 'a6.name')
at (src/cli/cmd/tui/context/local.tsx:151)

Root Cause

Multiple places in prompt/index.tsx and local.tsx access .name on potentially undefined objects.

Environment

  • OpenCode version: 1.1.13
  • OS: Arch Linux

Metadata

Metadata

Assignees

Labels

opentuiThis 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