claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Agent Teams: Spawned teammates don't inherit model configuration from team lead

Open gavinyao opened this issue 8 months ago โ€ข 17 comments

Summary

When using Agent Teams with a custom/internal model endpoint, spawned teammates fail to inherit the model configuration. The team lead works correctly with the configured model, but teammates attempt to use a different model ID (claude-opus-4-6), resulting in 403 permission errors.

Environment

  • Claude Code version: Latest (March 2026)
  • OS: macOS Darwin 24.6.0
  • Shell: zsh
  • Model configured: Internal/custom endpoint (e.g., internal-model-opus-aws)

Steps to Reproduce

  1. Configure Claude Code to use a custom/internal model endpoint
  2. Enable Agent Teams experimental feature:
    {
      "env": {
        "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
      }
    }
    
  3. Create a team:
    TeamCreate with team_name: "test-team"
    
  4. Spawn teammates:
    Agent with subagent_type: "general-purpose", team_name: "test-team"
    
  5. Send tasks to teammates via SendMessage

Expected Behavior

Teammates should inherit the same model configuration as the team lead and execute tasks normally.

Actual Behavior

  • Team lead works correctly with the configured internal model
  • Teammates repeatedly send idle_notification without executing any tasks
  • Teammates' API calls fail with 403 error:
API Error: 403 {
  "error": {
    "code": "",
    "message": "Token does not have permission to access model claude-opus-4-6",
    "type": "new_api_error"
  }
}

Analysis

Role Model Used Result
Team Lead internal-model-opus-aws (from config) โœ… Works
Teammates claude-opus-4-6 (hardcoded?) โŒ 403 Error

The teammates appear to use a hardcoded or default model ID (claude-opus-4-6) instead of inheriting from the team lead's configuration or the global settings.

Impact

Users with custom/internal API endpoints cannot use the Agent Teams feature at all. This blocks adoption for enterprise users or those using proxy endpoints.

Suggested Fix

Ensure spawned teammates inherit the model configuration from:

  1. The model parameter passed to the Agent tool, OR
  2. The team lead's current model configuration, OR
  3. The global settings.json configuration

Workaround Attempted

Tried specifying model: "haiku" or model: "sonnet" in the Agent tool parameters, but the issue persists (teammates still attempt to use claude-opus-4-6).

gavinyao avatar Mar 09 '26 07:03 gavinyao

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/29660
  2. https://github.com/anthropics/claude-code/issues/25094
  3. https://github.com/anthropics/claude-code/issues/23561

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

github-actions[bot] avatar Mar 09 '26 07:03 github-actions[bot]

Hitting this too with custom endpoints. We've added a doctor check for this in Cozempic v0.9.0:

pip install -U cozempic
cozempic doctor  # warns if agent teams are active but no model set in settings.json

The check detects when ~/.claude/settings.json is missing a model key while team directories are present โ€” since that's the condition where subagents silently fall back to claude-opus-4-6 instead of inheriting the team lead's config.

Workaround until fixed upstream: add "model": "your-model-id" explicitly to ~/.claude/settings.json. That ensures subagents pick it up rather than relying on env var inheritance which appears broken.

junaidtitan avatar Mar 09 '26 11:03 junaidtitan

thans for reply, but It's not work for me.

Claude Code v2.1.71

โฏ cozempic --version cozempic 0.9.0

โฏ cozempic doctor

COZEMPIC DOCTOR โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

โœ“ trust-dialog-hang         [OK]
  Trust dialog flag not set โ€” no issue

โœ“ hooks-trust-flag          [OK]
  Hooks trust flag set correctly โ€” hooks will load normally

โœ“ claude-json-corruption    [OK]
  .claude.json is valid (25160 bytes)

โœ“ corrupted-tool-use        [OK]
  No corrupted tool_use blocks found (132 sessions checked)

โœ“ orphaned-tool-results     [OK]
  No orphaned tool_result blocks found (132 sessions checked)

โœ“ zombie-teams              [OK]
  4 active team(s), no stale teams found

โœ“ agent-model-mismatch      [OK]
  Model 'internal-model-opus-aws' set in settings.json โ€” subagents should inherit correctly

โœ“ oversized-sessions        [OK]
  No oversized sessions found (132 sessions checked)

โœ“ stale-backups             [OK]
  No stale backup files found

โœ“ disk-usage                [OK]
  132 sessions using 49.5MB total

All clear โ€” no issues found.

gavinyao avatar Mar 09 '26 12:03 gavinyao

https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md#2172

  • Fixed team agents to inherit the leader's model

2.1.72 fix the bug, but I haven't verified it yet.

MasterXue avatar Mar 10 '26 06:03 MasterXue

2.1.72 fix the bug, but I haven't verified it yet.

I also noticed this fix, but I spent 3 hours researching version 2.1.72 and the issue still exists and has not been fixed

@team-lead> code-review โŽฟ ย API Error: 400 event:error data:{"code":"InvalidParameter","message":"model 'claude-opus-4-6' not found or not supported","request_id":"07ff7a59-4a17-94b6-99be-365b68c5b68f"}

it235 avatar Mar 10 '26 07:03 it235

2.1.72 fix the bug, but I haven't verified it yet.

I also noticed this fix, but I spent 3 hours researching version 2.1.72 and the issue still exists and has not been fixed

@team-lead> code-review โŽฟ ย API Error: 400 event:error data:{"code":"InvalidParameter","message":"model 'claude-opus-4-6' not found or not supported","request_id":"07ff7a59-4a17-94b6-99be-365b68c5b68f"}

Yes, I tested it and I'm sure it didn't fix it. @team-leadโฏ โŽฟ ย API Error: 400 {"error":{"code":"400","message":"Param Incorrect","param":"Not supported model claude-opus-4-6"}}

MasterXue avatar Mar 10 '26 07:03 MasterXue

2.1.72 fix the bug, but I haven't verified it yet.

I also noticed this fix, but I spent 3 hours researching version 2.1.72 and the issue still exists and has not been fixed @team-lead> code-review โŽฟ ย API Error: 400 event:error data:{"code":"InvalidParameter","message":"model 'claude-opus-4-6' not found or not supported","request_id":"07ff7a59-4a17-94b6-99be-365b68c5b68f"}

Yes, I tested it and I'm sure it didn't fix it. @team-leadโฏ โŽฟ ย API Error: 400 {"error":{"code":"400","message":"Param Incorrect","param":"Not supported model claude-opus-4-6"}}

I feel that this issue will not be fixed in the short term because unofficial sources are not taken seriously. I have searched through many issues but have not received any further updates. My boss is urging me why it is so simple that I cannot get through

it235 avatar Mar 10 '26 07:03 it235

2.1.72 fix the bug, but I haven't verified it yet.

I also noticed this fix, but I spent 3 hours researching version 2.1.72 and the issue still exists and has not been fixed @team-lead> code-review โŽฟ ย API Error: 400 event:error data:{"code":"InvalidParameter","message":"model 'claude-opus-4-6' not found or not supported","request_id":"07ff7a59-4a17-94b6-99be-365b68c5b68f"}

Yes, I tested it and I'm sure it didn't fix it. @team-leadโฏ โŽฟ ย API Error: 400 {"error":{"code":"400","message":"Param Incorrect","param":"Not supported model claude-opus-4-6"}}

I feel that this issue will not be fixed in the short term because unofficial sources are not taken seriously. I have searched through many issues but have not received any further updates. My boss is urging me why it is so simple that I cannot get through

Why does the Changelog say the issue has been fixed? I think Agent Teams works great, but this bug has made it unusable.

MasterXue avatar Mar 10 '26 07:03 MasterXue

v2.1.74 maybe fix it, i tested it

MasterXue avatar Mar 12 '26 07:03 MasterXue

@gavinyao โ€” teammates defaulting to the wrong model ID is a known alias resolution issue. I built claude-alias-patch that fixes this by patching the model resolver and env var whitelist in cli.js.

It also lets you register custom model aliases via ANTHROPIC_DEFAULT_*_MODEL env vars, so if you're using a custom endpoint, your aliases map directly to the correct model IDs. Single install script โ€” auto-patches your Claude instance.

East-rayyy avatar Mar 16 '26 22:03 East-rayyy

@gavinyao โ€” teammates defaulting to the wrong model ID is a known alias resolution issue. I built claude-alias-patch that fixes this by patching the model resolver and env var whitelist in cli.js.

It also lets you register custom model aliases via ANTHROPIC_DEFAULT_*_MODEL env vars, so if you're using a custom endpoint, your aliases map directly to the correct model IDs. Single install script โ€” auto-patches your Claude instance.

good work๏ผ

gavinyao avatar Mar 17 '26 02:03 gavinyao

getting 403's in my agent teams today with 2.1.85, but the main agent is fine, so afaict it's not a permission issue.

freeformz avatar Mar 26 '26 23:03 freeformz

What seems to be happening is CC is picking the wrong arn, even though my ANTHROPIC_DEFAULT_OPUS_MODEL is set to the correct arn.

Example: My config says ...

"ANTHROPIC_DEFAULT_OPUS_MODEL": "arn:aws:bedrock:us-east-2:<id>:inference-profile/global.anthropic.claude-opus-4-6-v1",

but the error message says

arn:aws:bedrock:us-east-2:<id>:inference-profile/us.anthropic.claude-opus-4-6-v1

freeformz avatar Mar 26 '26 23:03 freeformz

it also takes minutes to get the 403 errors.

freeformz avatar Mar 26 '26 23:03 freeformz

PS E:\Claude Code> claude -v 2.1.112 (Claude Code) ไป็„ถๅญ˜ๅœจ่ฟ™ไธช้—ฎ้ข˜ๅ•Š

Qingco avatar Apr 17 '26 19:04 Qingco

This was solved for me by modelOverrides in settings.

freeformz avatar May 19 '26 23:05 freeformz

This was solved for me by modelOverrides in settings.

It works!

tangwei-dev avatar Jun 10 '26 03:06 tangwei-dev

Closing for now โ€” inactive for too long. Please open a new issue if this is still relevant.

github-actions[bot] avatar Jul 18 '26 10:07 github-actions[bot]

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.

github-actions[bot] avatar Sep 15 '26 14:09 github-actions[bot]