opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Custom subagents with explicit model config throw ProviderModelNotFoundError

Open esilverio opened this issue 1 month ago • 4 comments

Description

When a primary agent invokes a custom subagent (defined in opencode.json) via the Task tool, the subagent fails with ProviderModelNotFoundError even though:

  1. The model is explicitly configured for that subagent
  2. 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:

  1. Configure a primary agent with explicit model (ex: claude-sonnet-4.5)
  2. Configure a subagent with explicit model (ex: claude-opus-4.5)
  3. Start a session with the primary agent
  4. 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

esilverio avatar Dec 16 '25 12:12 esilverio

hm okay ill take a look

rekram1-node avatar Dec 16 '25 12:12 rekram1-node

I cannot replicate your issue can you show me output of: opencode debug config

rekram1-node avatar Dec 16 '25 16:12 rekram1-node

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,q", "editor_open": "e", "theme_list": "t", "sidebar_toggle": "b", "scrollbar_toggle": "none", "username_toggle": "none", "status_view": "s", "session_export": "x", "session_new": "n", "session_list": "l", "session_timeline": "g", "session_share": "none", "session_unshare": "none", "session_interrupt": "escape", "session_compact": "c", "messages_page_up": "pageup", "messages_page_down": "pagedown", "messages_half_page_up": "ctrl+alt+u", "messages_half_page_down": "ctrl+alt+d", "messages_first": "ctrl+g,home", "messages_last": "ctrl+alt+g,end", "messages_last_user": "none", "messages_copy": "y", "messages_undo": "u", "messages_redo": "r", "messages_toggle_conceal": "h", "tool_details": "none", "model_list": "m", "model_cycle_recent": "f2", "model_cycle_recent_reverse": "shift+f2", "model_cycle_favorite": "none", "model_cycle_favorite_reverse": "none", "command_list": "ctrl+p", "agent_list": "a", "agent_cycle": "tab", "agent_cycle_reverse": "shift+tab", "input_clear": "ctrl+c", "input_paste": "ctrl+v", "input_submit": "return", "input_newline": "shift+return,ctrl+return,alt+return,ctrl+j", "input_move_left": "left,ctrl+b", "input_move_right": "right,ctrl+f", "input_move_up": "up", "input_move_down": "down", "input_select_left": "shift+left", "input_select_right": "shift+right", "input_select_up": "shift+up", "input_select_down": "shift+down", "input_line_home": "ctrl+a", "input_line_end": "ctrl+e", "input_select_line_home": "ctrl+shift+a", "input_select_line_end": "ctrl+shift+e", "input_visual_line_home": "alt+a", "input_visual_line_end": "alt+e", "input_select_visual_line_home": "alt+shift+a", "input_select_visual_line_end": "alt+shift+e", "input_buffer_home": "home", "input_buffer_end": "end", "input_select_buffer_home": "shift+home", "input_select_buffer_end": "shift+end", "input_delete_line": "ctrl+shift+d", "input_delete_to_line_end": "ctrl+k", "input_delete_to_line_start": "ctrl+u", "input_backspace": "backspace,shift+backspace", "input_delete": "ctrl+d,delete,shift+delete", "input_undo": "ctrl+-,super+z", "input_redo": "ctrl+.,super+shift+z", "input_word_forward": "alt+f,alt+right,ctrl+right", "input_word_backward": "alt+b,alt+left,ctrl+left", "input_select_word_forward": "alt+shift+f,alt+shift+right", "input_select_word_backward": "alt+shift+b,alt+shift+left", "input_delete_word_forward": "alt+d,alt+delete,ctrl+delete", "input_delete_word_backward": "ctrl+w,ctrl+backspace,alt+backspace", "history_previous": "up", "history_next": "down", "session_child_cycle": "right", "session_child_cycle_reverse": "left", "terminal_suspend": "ctrl+z" } }

esilverio avatar Dec 17 '25 14:12 esilverio

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)

gliatti avatar Dec 20 '25 11:12 gliatti

@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

rekram1-node avatar Dec 20 '25 16:12 rekram1-node