Custom subagents with explicit model config throw ProviderModelNotFoundError
Description
When a primary agent invokes a custom subagent (defined in opencode.json) via the Task tool, the subagent fails with ProviderModelNotFoundError even though:
- The model is explicitly configured for that subagent
- The model is available and works when selected directly via /models
Environment:
- OpenCode version: latest
- OS: Windows 11
- Provider: github-copilot opencode.json configuration: { agent: { agentA: { mode: primary, model: github-copilot/claude-sonnet-4.5, maxSteps: 50 }, agentB: { mode: subagent, model: github-copilot/claude-opus-4.5, maxSteps: 20 } } }
OpenCode version
1.0.155
Steps to reproduce
Steps to reproduce:
- Configure a primary agent with explicit model (ex: claude-sonnet-4.5)
- Configure a subagent with explicit model (ex: claude-opus-4.5)
- Start a session with the primary agent
- Primary agent invokes Task tool with subagent_type: "agentB"
Expected behavior: AgentB subagent should start using claude-opus-4.5 as configured in opencode.json Actual behavior: ProviderModelNotFoundError: ProviderModelNotFoundError Additional context:
- The model claude-opus-4.5 IS available and works when selected directly via /models
- Using subagent_type: "general" works correctly
Workaround: Using subagent_type: "general" with detailed prompts that simulate the specialized agent's behavior.
Screenshot and/or share link
No response
Operating System
Windows 11
Terminal
Windows Terminal
hm okay ill take a look
I cannot replicate your issue can you show me output of:
opencode debug config
Hi, off course.
{
"$schema": "https://opencode.ai/config.json",
"agent": {
"gohan": {
"model": "github-copilot/claude-sonnet-4.5",
"temperature": 0.2,
"prompt": "...",
"tools": {
"write": true,
"edit": true,
"bash": true,
"read": true,
"task": true
},
"description": "...",
"mode": "all",
"maxSteps": 15,
"permission": {
"edit": "allow",
"bash": "allow",
"webfetch": "allow"
}
},
"takeshi": {
"model": "github-copilot/claude-opus-4.5",
"temperature": 0.1,
"prompt": "...",
"tools": {
"write": true,
"edit": true,
"bash": true,
"read": true,
"webfetch": true
},
"description": "...",
"mode": "subagent",
"maxSteps": 20,
"permission": {
"edit": "allow",
"bash": "allow",
"webfetch": "allow"
}
},
"yuki": {
"model": "github-copilot/claude-sonnet-4.5",
"temperature": 0.2,
"prompt": "...",
"tools": {
"write": true,
"edit": true,
"bash": true,
"read": true
},
"description": "...",
"mode": "subagent",
"maxSteps": 15,
"permission": {
"edit": "allow",
"bash": "allow",
"webfetch": "allow"
}
},
"sakura": {
"model": "github-copilot/gpt-5.1-codex",
"temperature": 0.3,
"prompt": "...",
"tools": {
"write": true,
"edit": true,
"bash": true,
"read": true,
"glob": true,
"grep": true
},
"description": "...",
"mode": "subagent",
"maxSteps": 30,
"permission": {
"edit": "allow",
"bash": "allow",
"webfetch": "allow"
}
},
"hiroshi": {
"model": "github-copilot/claude-opus-4.5",
"temperature": 0.1,
"prompt": "...",
"tools": {
"write": true,
"edit": true,
"bash": true,
"read": true,
"grep": true
},
"description": "...",
"mode": "subagent",
"maxSteps": 20,
"permission": {
"edit": "allow",
"bash": {
"git ": "allow",
"": "ask"
},
"webfetch": "allow"
}
},
"kaito": {
"model": "github-copilot/claude-sonnet-4.5",
"temperature": 0.1,
"prompt": "...",
"tools": {
"write": true,
"edit": true,
"bash": true,
"read": true,
"grep": true
},
"description": "...",
"mode": "subagent",
"maxSteps": 20,
"permission": {
"edit": "allow",
"bash": {
"npm test*": "allow",
"dotnet test*": "allow",
"mvn test*": "allow",
"*": "ask"
},
"webfetch": "allow"
}
},
"kenji": {
"model": "github-copilot/claude-haiku-4.5",
"temperature": 0.2,
"prompt": "...",
"tools": {
"write": true,
"edit": true,
"bash": true,
"read": true
},
"description": "...",
"mode": "subagent",
"maxSteps": 15,
"permission": {
"edit": "allow",
"bash": {
"git ": "allow",
"": "ask"
},
"webfetch": "allow"
}
},
"akira": {
"model": "github-copilot/claude-opus-4.5",
"temperature": 0.2,
"prompt": "...",
"tools": {
"write": true,
"edit": true,
"bash": true,
"read": true,
"glob": true,
"grep": true
},
"description": "...",
"mode": "subagent",
"maxSteps": 25,
"permission": {
"edit": "allow",
"bash": {
"git ": "allow",
"": "ask"
},
"webfetch": "allow"
}
}
},
"mcp": {
"context7": {
"type": "remote",
"url": "https://mcp.context7.com/mcp",
"enabled": true,
"headers": {
"CONTEXT7_API_KEY": ""
}
}
},
"mode": {},
"plugin": [],
"command": {},
"username": "eduardo.m.silverio",
"keybinds": {
"leader": "ctrl+x",
"app_exit": "ctrl+c,ctrl+d,
I'm experiencing a similar issue with custom agents defined via markdown files in ~/.config/opencode/agent/.
When specifying a model: field in the YAML frontmatter, opencode adds a trailing / to the model name, causing validation to fail.
Example agent configuration:
---
description: Expert PostgreSQL - recherche dans la documentation RAG
model: ollama:qwencoder14b:latest
mode: primary
temperature: 0.1
---
Error message:
Agent postgresql-expert's configured model ollama:qwencoder14b:latest/ is not valid
Note the trailing / added to the model name (qwencoder14b:latest/).
Workaround: Removing the model: field from the agent definition allows the agent to use the default model successfully.
Environment:
- OpenCode version: 1.0.174
- OS: Ubuntu 24.04.3 LTS (WSL2, kernel 6.6.87.2-microsoft-standard-WSL2)
- Provider: Ollama 0.13.3 (local)
@robinportigliatti your model does not appear to be valid it always needs to be in format:
provider/model
so either your provider prefix is missing or you arent using correct separator
to see valid model ids just run:
opencode models