Skip to content

Custom subagents with explicit model config throw ProviderModelNotFoundError #5623

Closed

Description

@esilverio

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

Activity

  1. rekram1-node commented on Dec 16, 2025

    @rekram1-node
    Collaborator

    hm okay ill take a look

  2. rekram1-node commented on Dec 16, 2025

    @rekram1-node
    Collaborator

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

  3. esilverio commented on Dec 17, 2025

    @esilverio
    Author

    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"
    }
    }

  4. gliatti commented on Dec 20, 2025

    @gliatti

    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)
  5. rekram1-node commented on Dec 20, 2025

    @rekram1-node
    Collaborator

    @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

  6. diegonix commented on Jan 20, 2026

    @diegonix

    opencode is adding \n in the end of the model line:

    opencode debug config
    ...
        "my-agent": {
          "model": "synthetic/hf:zai-org/GLM-4.7\n",
    ...

    agent config file:

    description: My Agent
    mode: subagent
    model: synthetic/hf:zai-org/GLM-4.7
    options:
    ...
    
  7. mdc-git commented on Jan 23, 2026

    @mdc-git
    ~/.config/opencode/agent$ cat glm.md
    ---
    description: General purpose GLM model agent
    model: synthetic/hf:zai-org/GLM-4.7
    ---
    

    Same issue, I tried hf:zai-org/GLM-4.7 and synthetic/GLM-4.7 as well.

    $ opencode models synthetic
    synthetic/hf:deepseek-ai/DeepSeek-R1
    synthetic/hf:deepseek-ai/DeepSeek-R1-0528
    synthetic/hf:deepseek-ai/DeepSeek-V3
    synthetic/hf:deepseek-ai/DeepSeek-V3-0324
    synthetic/hf:deepseek-ai/DeepSeek-V3.1
    synthetic/hf:deepseek-ai/DeepSeek-V3.1-Terminus
    synthetic/hf:deepseek-ai/DeepSeek-V3.2
    synthetic/hf:meta-llama/Llama-3.1-405B-Instruct
    synthetic/hf:meta-llama/Llama-3.1-70B-Instruct
    synthetic/hf:meta-llama/Llama-3.1-8B-Instruct
    synthetic/hf:meta-llama/Llama-3.3-70B-Instruct
    synthetic/hf:meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8
    synthetic/hf:meta-llama/Llama-4-Scout-17B-16E-Instruct
    synthetic/hf:MiniMaxAI/MiniMax-M2
    synthetic/hf:MiniMaxAI/MiniMax-M2.1
    synthetic/hf:moonshotai/Kimi-K2-Instruct-0905
    synthetic/hf:moonshotai/Kimi-K2-Thinking
    synthetic/hf:openai/gpt-oss-120b
    synthetic/hf:Qwen/Qwen2.5-Coder-32B-Instruct
    synthetic/hf:Qwen/Qwen3-235B-A22B-Instruct-2507
    synthetic/hf:Qwen/Qwen3-235B-A22B-Thinking-2507
    synthetic/hf:Qwen/Qwen3-Coder-480B-A35B-Instruct
    synthetic/hf:zai-org/GLM-4.5
    synthetic/hf:zai-org/GLM-4.6
    synthetic/hf:zai-org/GLM-4.7
    

    EDIT: Nevermind. Putting quotation marks around the model name seems to fix this. Wasn't needed for opencode provider though.

    model: "synthetic/hf:zai-org/GLM-4.7"
    

    works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions