[BUG] Unsupported (?) model in agent config silently fails instead of erroring

Status Fixed / completed
Maintainer reply ✓ Yes — wolffiex
Activity 6 comments · opened Mar 9, 2026 · closed Mar 11, 2026
💡 Likely answer: A maintainer (wolffiex, collaborator) responded on this thread — see the highlighted reply below.

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When I specify a model in agent configuration, certain model names are silently rejected—even if those same names work with the --model CLI flag. There are two failure modes:

Failure mode 1: Silent fallback (frontmatter agents)

With the main agent running Opus 4.6 + high effort, I created a subagent with this frontmatter:

---
name: player
description: The player agent is used to debug an agent bug
model: claude-opus-4-5
---
Answer only on which exact model version you run, then STOP.

The agent spawns, but uses the main agent's config (Opus 4.6 with high effort) instead of the specified model. No warning, no error—just unexpected token burn.

Failure mode 2: Agent doesn't register (--agents flag)

When passing agents via CLI:

claude --agents '{
  "player": {
    "description": "Agent educator",
    "prompt": "Tell me what model you are, then STOP",
    "model": "claude-opus-4-5"
  }
}'

The agent simply doesn't exist. Asking to "spawn a player agent" results in:

What do you mean by "player agent"? Could you give me more context on what it should do?

No error about invalid model, no error about failed registration—the agent is silently dropped.

What Should Happen?

If a model name is invalid or unsupported for agents, Claude Code should error immediately with a clear message, e.g.:

Error: Model 'claude-opus-4-5' is not supported for agents. Supported models: claude-sonnet-4-6, claude-opus-4-6, ...

Or better: support the same models for agents that work with --model.

Error Messages/Logs

None—that's the problem. Both failures are completely silent.

Steps to Reproduce

  1. Run claude --model claude-opus-4-5 (works fine)
  2. Create an agent with model: claude-opus-4-5 in frontmatter, or via --agents JSON
  3. Observe: no error, but the model is ignored or the agent doesn't register

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

N/A

Claude Code Version

Latest

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Other

Additional Information

The core inconsistency: claude --model claude-opus-4-5 works, but model: claude-opus-4-5 in agent config doesn't. The same model name should either work everywhere or error everywhere.

View original on GitHub ↗

6 Comments

github-actions[bot] · 5 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/18346
  2. https://github.com/anthropics/claude-code/issues/31027
  3. https://github.com/anthropics/claude-code/issues/18873

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

wolffiex collaborator · 5 months ago

Thanks for this report. Investigating

wolffiex collaborator · 5 months ago

Thanks for the detailed report! We've identified the issue — agent config was only accepting model aliases (opus, sonnet, haiku, etc.), not full model IDs like claude-opus-4-5. The runtime already handled full IDs fine; only the parse-time validation was overly strict.

Fix should be in tomorrow's release. Once it lands, model: claude-opus-4-5 in frontmatter and --agents JSON will work the same way as --model claude-opus-4-5 does on the CLI.

wolffiex collaborator · 5 months ago

I should add that we can't be too strict about what we accept though; different configs require different model strings that can't be known at build time.

NickSdot · 5 months ago

Fix landed in 2.1.74, thanks @wolffiex!

Edit: turns out the --agent flag still doesn't work as expected. Though, the model version is correctly set, but the agent not recognised (even with short-alias). It's a bit weird, I could swear with the default alias it worked earlier. Opened a follow up https://github.com/anthropics/claude-code/issues/33513

github-actions[bot] · 5 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.