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
Error when trying to use custom primary agent (TypeError: undefined is not an object (evaluating 'agent.variant')) #13790
I set up a primary agent according to the docs at https://opencode.ai/docs/agents, in my global OpenCode config at ~/.config/opencode/opencode.json:
{
"agent": {
"build-guarded": {
"description": "Build-like primary agent that asks before any file edits.",
"mode": "primary",
"name": "Build (guarded)",
"permission": {
"edit": "ask",
"plan_enter": "allow",
"question": "allow"
}
}
},
/* rest of the config ... */
}
When I select this agent and try to prompt it, I always get this error:
TypeError: undefined is not an object (evaluating 'agent.variant') at createUserM
I tried adding both model and variant properties but I still got the exact same error, but I shouldn't have to specify this anyway as the docs mention:
If you don’t specify a model, primary agents use the model globally configured while subagents will use the model of the primary agent that invoked the subagent.
Plugins
None
OpenCode version
1.2.5
Steps to reproduce
Configure OpenCode with a custom primary agent (as mentioned in my description).
Launch OpenCode.
Press Tab to select your agent.
Enter any message, submit it.
See error.
Screenshot and/or share link
I'm unable to share a link to the session, but this is the error:
Operating System
macOS 26.2
Terminal
Happens in every terminal I've tried (Warp, iTerm 2, Ghostty, and WebStorm's integrated terminal).
This issue appears to be related to #7138, which requests support for default variant configuration per agent. The error you're encountering suggests that the agent.variant field may not be fully implemented or recognized in your version.
Please verify:
That you're using the latest version of OpenCode (you have v1.2.5)
Check the release notes to see if variant configuration support has been added since your version
Activity
github-actions commentedon Feb 16, 2026
This issue appears to be related to #7138, which requests support for default variant configuration per agent. The error you're encountering suggests that the
agent.variantfield may not be fully implemented or recognized in your version.Please verify:
If you continue to experience this issue after updating, please provide any additional error context or logs.
rekram1-node commentedon Feb 16, 2026
It's because these dont match:
Ofc it is a bug but just letting u know so u can have work around for now
github-actions commentedon Apr 18, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.