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