You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Agent.get() returns undefined without error handling, causing crash #9437
Agent.get() returns undefined when an agent doesn't exist, but callers like createUserMessage() don't handle this case, causing a crash:
TypeError: undefined is not an object (evaluating 'agent.name')
at createUserMessage (src/session/prompt.ts:831:14)
The issue is in src/agent/agent.ts line 246-248:
exportasyncfunctionget(agent: string){returnstate().then((x)=>x[agent])// Returns undefined if not found}
And src/session/prompt.ts line 825, 833:
constagent=awaitAgent.get(input.agent??(awaitAgent.defaultAgent()))// ...agent: agent.name,// Crashes here when agent is undefined
This can be triggered by any caller passing an invalid agent name - in my case, it was the plannotator plugin defaulting to "build" when I had that agent disabled.
Plugins
@plannotator/opencode@0.6.6
OpenCode version
v1.1.25
Steps to reproduce
Disable the default build agent in opencode config:
{ "agent": { "build": { "disable": true } } }
Install plannotator plugin
Use plannotator to create and approve a plan (without changing agent switch setting in plannotator UI)
OpenCode crashes with TypeError
Screenshot and/or share link
N/A - crash occurs before UI can render
Operating System
Fedora Linux
Terminal
Ghostty
Suggested Fix
Either:
Agent.get() should throw a descriptive error when agent not found
Or createUserMessage() should validate and provide a helpful message like: "Agent 'build' not found. Available agents: [list]"
This is a defensive fix - callers shouldn't need to know that Agent.get() can return undefined.
Activity
github-actions commentedon Jan 19, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
rcdailey commentedon Jan 21, 2026
@rekram1-node duplicate of what issue specifically?