[BUG] Task tool subagents don't inherit EU cross-region inference model configuration for AWS Bedrock
Status Fixed / completed
Maintainer reply ✓ Yes — bcherny
Workaround ✓ Mentioned in thread ↓
Activity 8 comments · opened Nov 12, 2025 · closed Dec 24, 2025
💡 Likely answer: A maintainer (bcherny, 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 using AWS Bedrock with EU cross-region inference models (model ID format: eu.anthropic.claude-sonnet-4-5-20250929-v1:0), the Task tool fails to launch subagents because it attempts to use the standard US model ID format
(anthropic.claude-sonnet-4-5-20250929-v1:0) instead of inheriting the configured EU model ID.
This results in a 403 authentication error because the AWS IAM role has access to the EU cross-region model but not the US format model.
What Should Happen?
The Task tool should inherit the configured model ID (eu.anthropic.claude-sonnet-4-5-20250929-v1:0) and successfully launch subagents using the same model configuration as the main conversation.
Error Messages/Logs
API Error: 403 {"Message":"User: arn:aws:sts::xxxxx:assumed-role/xxxxx/xxxxx@xxxxxx.se is
not authorized to perform: bedrock:InvokeModel on resource: arn:aws:bedrock:::foundation-model/anthropic.claude-sonnet-4-5-20250929-v1:0 with an
explicit deny in a service control policy"} · Please run /login
Steps to Reproduce
- Configure Claude Code to use AWS Bedrock in eu-central-1 region
- Set model to: eu.anthropic.claude-sonnet-4-5-20250929-v1:0 (EU cross-region inference format)
- Verify main conversation works (it does, I can interact normally)
- Attempt to launch a subagent using the Task tool with any subagent_type (e.g., general-purpose, Explore)
- Observe the 403 error
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.37 (Claude Code)
Platform
AWS Bedrock
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
_No response_
8 Comments
---
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
---
While they share similar themes around subagent configuration inheritance, I'd say this is (probably) a distinct bug:
us.prefix)anthropic.claude-*) instead of the configured EU cross-region format (eu.anthropic.claude-*)The error codes and failure modes are different enough that these may require separate fixes, even if they share a common root cause around configuration inheritance.
Possible Root Cause
I inspected the compiled
cli.jsand found what might be causing this issue.Around line 497, there appear to be hardcoded model definitions:
```javascript
TJ1 = {
firstParty: "claude-sonnet-4-5-20250929",
bedrock: "us.anthropic.claude-sonnet-4-5-20250929-v1:0",
...
}
qJA = {
firstParty: "claude-haiku-4-5-20251001",
bedrock: "us.anthropic.claude-haiku-4-5-20251001-v1:0",
...
}
```
It looks like Task tool subagents may be using these hardcoded us.anthropic.* model IDs instead of respecting the ANTHROPIC_MODEL and ANTHROPIC_SMALL_FAST_MODEL environment variables that work for the main
agent.
Why This Would Explain the Issue
Attempted Workarounds (None Worked)
Suggested Fix
If this is the issue, the Task tool should respect these environment variables when selecting models for subagents.
Summary
I used Claude Code to help me analyze bug #11489, and this is what I arrived at:
Task tool subagents fail when using AWS Bedrock in EU regions (eu-central-1) due to hardcoded model IDs that don't support cross-region inference profiles. The main Claude Code agent respects the
ANTHROPIC_MODELenvironment variable, but Task subagents ignore environment variables and use hardcoded model identifiers that are either:us.anthropic.*(blocked by AWS Service Control Policies restricting non-EU regions)anthropic.*(defaults to us-east-1, also blocked)claude-3-5-haiku-20241022)Environment
Claude Code Version: 2.0.37
Installation: Homebrew (also tested with npm)
Platform: macOS (Darwin 24.6.0)
Issue Details
Main Agent vs Task Subagents Behavior
| Component | Respects Env Vars | Model ID Used | Result |
|-----------|-------------------|---------------|--------|
| Main Agent | ✅ Yes |
eu.anthropic.claude-sonnet-4-5-20250929-v1:0| ✅ Works || Task Subagent (haiku) | ❌ No |
us.anthropic.claude-3-5-haiku-20241022-v1:0| ❌ 400 error || Task Subagent (sonnet) | ❌ No |
anthropic.claude-sonnet-4-5-20250929-v1:0| ❌ 403 error |Error Messages
With
model=haiku:With
model=sonnet:Investigation & Root Cause Analysis
1. Hardcoded Model IDs in Binary
By examining the compiled binary with
strings, we identified hardcoded model ID definitions:Key findings:
us.anthropic.*prefix (7 models)anthropic.*prefix (no region)2. Available EU Cross-Region Models
We verified which models exist in
eu-central-1:Available with
eu.anthropic.*prefix:eu.anthropic.claude-3-haiku-20240307-v1:0(old haiku 3.0)eu.anthropic.claude-haiku-4-5-20251001-v1:0(new haiku 4.5)eu.anthropic.claude-3-sonnet-20240229-v1:0eu.anthropic.claude-3-5-sonnet-20240620-v1:0eu.anthropic.claude-3-7-sonnet-20250219-v1:0eu.anthropic.claude-sonnet-4-20250514-v1:0eu.anthropic.claude-sonnet-4-5-20250929-v1:0NOT available in EU:
eu.anthropic.claude-3-5-haiku-20241022-v1:0(doesn't exist)3. Model ID Prefix Behavior
| Prefix | Behavior | Works in EU with SCP? |
|--------|----------|---------------------|
|
us.anthropic.*| Explicit US cross-region | ❌ No (403 - blocked by SCP) ||
anthropic.*| Defaults to us-east-1 | ❌ No (403 - blocked by SCP) ||
eu.anthropic.*| Explicit EU cross-region | ✅ Yes |Attempted Workarounds
Workaround 1: Binary Patching (Partial Success)
We attempted to patch the compiled binary by replacing string literals:
Results:
us.anthropic.*prefixanthropic.*→eu.anthropic.*(3 character length difference corrupts binary)Workaround 2: Environment Variables (Not Respected)
Setting
ANTHROPIC_SMALL_FAST_MODELhas no effect on Task subagents:Task subagents still use hardcoded
us.anthropic.claude-3-5-haiku-20241022-v1:0.Test Results Summary
| Test # | Binary Used | Model Param | Attempted Model ID | Error | Duration |
|--------|-------------|-------------|-------------------|-------|----------|
| 1 | npm (unpatched) | haiku |
us.anthropic.claude-3-5-haiku-20241022-v1:0| 400 | ~1s || 2 | Homebrew (patched) | haiku |
eu.anthropic.claude-3-5-haiku-20241022-v1:0| 400 | ~1s || 3 | Homebrew (patched) | sonnet |
anthropic.claude-sonnet-4-5-20250929-v1:0| 403 | 3m 11s |Recommended Upstream Fixes
Option 1: Respect Environment Variables (Preferred)
Task subagents should respect the same environment variables as the main agent:
Option 2: Detect AWS Region Automatically
Option 3: Configuration File
Add a
.claude-code.config.jsonor similar:Option 4: Update Default Model Definitions
For Bedrock deployments, use region-aware model IDs:
Additional Observations
Non-Existent Models in EU
The default haiku model (
claude-3-5-haiku-20241022) doesn't exist in EU cross-region profiles. EU users should use:eu.anthropic.claude-haiku-4-5-20251001-v1:0(Haiku 4.5) - Recommendedeu.anthropic.claude-3-haiku-20240307-v1:0(Haiku 3.0) - LegacyService Control Policy Context
Many AWS organizations use SCPs to restrict cross-region data transfer. A common policy:
This makes
us.anthropic.*and plainanthropic.*prefixes unusable in EU-only environments.Impact
Severity: High
Affected Users: All AWS Bedrock users in EU regions with restrictive SCPs
Workaround: None that fully works
Feature Impact: Task tool (Explore, Plan, other subagents) completely non-functional
Reproduction Steps
eu-central-1)``
bash
``export AWS_REGION=eu-central-1
export ANTHROPIC_MODEL=eu.anthropic.claude-sonnet-4-5-20250929-v1:0
export CLAUDE_CODE_USE_BEDROCK=1
Files Analyzed
/opt/homebrew/Caskroom/claude-code/2.0.37/claude(Homebrew binary)$HOME/.nvm/versions/node/v22.18.0/lib/node_modules/@anthropic-ai/claude-code/cli.js(npm binary)Conclusion
The Task tool subagents in Claude Code 2.0.37 have hardcoded US-region Bedrock model IDs that cannot be overridden via environment variables. This makes the Task tool completely unusable for AWS Bedrock deployments in EU regions with restrictive Service Control Policies.
While binary patching can partially work around this issue, it has fundamental limitations (string length constraints, runtime model construction, non-existent models) that make it unsuitable as a long-term solution.
An upstream fix is required to make Claude Code's Task tool compatible with AWS Bedrock cross-region inference profiles outside of the US.
---
I'm getting a similar error running the command
/context:When using a model on AWS Bedrock:
@bcherny how to proceed? I would love to see this fixed for my EU-bound organisation.
Fix incoming
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.