Skip to content

Subagent spawned via Task tool without its own variant inherits parent's variant concatenated onto model ID (model#variant), causing "Model not found" errors #50698

Closed as not planned

Description

@Skyworkdev

Description

Description (the bug description + error, same as before):
When a subagent is spawned via the Task tool and the target agent has no variant of its own defined, it appears to inherit the parent session's active variant — but instead of applying it as a separate parameter (as the config schema and task.ts both do correctly), something downstream joins it onto the model ID as a single #-delimited string before the request reaches the provider.

Our agent's model field is a clean "litellm/" — no # suffix anywhere in our own config. specs/v2/config.md explicitly documents model and variant as separate fields specifically to avoid ambiguity, since model IDs can contain slash-delimited segments. The SessionModel schema ({ id, providerID, variant: optional(Schema.String) }) and task.ts (const variant = msg.info.variant; const model = next.model ?? { modelID: msg.info.modelID, providerID: msg.info.providerID }) both keep model and variant distinct at that point — something downstream rejoins them into one invalid string.

Error observed:

Model not found: litellm/us-gov.anthropic.claude-sonnet-5#medium
The configured model ID (litellm/us-gov.anthropic.claude-sonnet-5#medium) is invalid. Suggested valid alternatives: us-gov.anthropic.claude-sonnet-5, us-gov.anthropic.claude-opus-4-8, us-gov.anthropic.claude-opus-5.

Plugins

none

OpenCode version

1.18.30

Steps to reproduce

  1. Select a non-default reasoning-effort variant on a session (e.g., cycle via the variant keybind to "medium").
  2. Spawn a subagent via the Task tool, targeting an agent definition that has no variant of its own.
  3. Observe the request fails with: Model not found: /#

Screenshot and/or share link

Image

Operating System

Ubuntu 24.04

Terminal

linux terminal

Activity

  1. github-actions commented on Sep 22, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    For keybind-related issues, please also check our pinned keybinds documentation: #4997

  2. Skyworkdev commented on Sep 22, 2026

    @Skyworkdev
    Author

    Not the same bug related theme, different failure mode:

  3. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions