[BUG] general-purpose subagent returns 500 on Bedrock Opus 4.7 while same profile works on main thread, Plan, Explore
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?
The general-purpose built-in subagent fails 100% of the time with API Error: 500 on a Bedrock application inference profile pointing at Claude Opus 4.7. The same inference profile works fine on the main thread, on the Plan subagent (which also inherits the parent Opus model), and on Explore (Haiku). Failure is independent of prompt content/size — a 16-word prompt fails identically to a 5,000-word prompt.
Reproduction matrix from a single session, same auth, same inference profile:
| Dispatch | Model profile | Result |
|---|---|---|
| Main-thread requests | Opus 4.7 (t1futowidw7s) | success |
| Agent(general-purpose, ~5000-word prompt) | Opus 4.7 (t1futowidw7s) | 500, 11 retries |
| Agent(general-purpose, 16-word prompt) | Opus 4.7 (t1futowidw7s) | 500, 11 retries |
| Agent(Plan, trivial prompt) | Opus 4.7 (t1futowidw7s) | success |
| Agent(Explore, trivial prompt) | Haiku 4.5 (7wx0gfm430bi) | success |
| Agent(claude-code-guide, plugin agent) | Opus 4.7 (t1futowidw7s) | success |
Failure is specific to general-purpose — not Opus, not Bedrock generally, not auth, not prompt size. CloudWatch shows zero InvocationServerErrors / InvocationClientErrors / InvocationThrottles for the inference profile during the failure window, and the 12 failed retries do not appear in Invocations either, suggesting Bedrock is rejecting the request at the API/validation layer before model invocation but returning InternalServerError instead of ValidationException.
Hypothesis: the general-purpose subagent advertises Tools: * (all tools), versus Plan's curated subset (All tools except Agent, ExitPlanMode, Edit, Write, NotebookEdit). The full tool list — possibly combined with the 10-skill attachment — likely produces a request payload that Bedrock's Opus 4.7 endpoint rejects (oversized JSONSchema, an unsupported keyword, or a per-request total-tools / schema-size limit). Plan succeeds with the same Opus 4.7 profile and the same 10 skills attached, so the model and the skills are not the trigger; the tool payload is the prime suspect.
Environment
- Claude Code:
2.1.138 - Build hashes seen in debug log:
2.1.138.8f9(main thread),2.1.138.04c(subagent dispatch) - Provider: AWS Bedrock (
CLAUDE_CODE_USE_BEDROCK=1) - Auth:
AWS_BEARER_TOKEN_BEDROCK(long-lived bearer token) - Region:
eu-north-1 ANTHROPIC_MODEL(Opus 4.7):arn:aws:bedrock:eu-north-1:<acct>:application-inference-profile/t1futowidw7s— cross-region profile spanning eu-north-1 / eu-west-1 / eu-west-3 / eu-central-1 / eu-south-1 / eu-south-2ANTHROPIC_DEFAULT_HAIKU_MODEL(Haiku 4.5):application-inference-profile/7wx0gfm430bieffortLevel: xhighin user settings (CLAUDE_EFFORT=xhighenv)- One MCP server configured (
aws-docsviamcp-proxy-for-aws==1.4.2); not exercised during failures - OS: Linux 6.6.87.2-microsoft-standard-WSL2 (WSL2 Ubuntu)
What Should Happen?
Agent({subagent_type: "general-purpose", ...}) should successfully dispatch to the configured model on Bedrock — same as Plan and Explore do today on the same auth and inference profile.
If the underlying request really is invalid, Claude Code should surface the Bedrock ValidationException (or whatever specific error code is returned) rather than retrying eleven times against an opaque 500. As of 2.1.138 the user-visible error is just API Error: 500 The system encountered an unexpected error during processing with no indication of the failing field — only /debug reveals the underlying Internal server error payload.
Error Messages/Logs
Captured request_ids (two independent dispatches):
- `req_atpmelnfkc354f5xkfty6p6ssr2jubtk7hrsjqhlhjlbzeuijjza`
- `req_zyb7mkprl3cmjfkxcgdyqc7vfb5acwc42mmtbpnkv7oegld4xo3q`
Excerpt from `~/.claude/debug/<session-id>.txt` (full log available, ~400 lines):
[Stall] tool_dispatch_start tool=Agent toolUseId=toolu_bdrk_01MY9vQUg9k5QW76ogk3HYPy permissionDecisionMs=0
[DEBUG] Sending 10 skills via attachment (initial, 10 total sent)
[DEBUG] Dynamic tool loading: 0/15 deferred tools included
[DEBUG] [API REQUEST] /model/<inference-profile-arn>/invoke-with-response-stream source=agent:builtin:general-purpose
[ERROR] Error streaming, falling back to non-streaming mode: {"type":"error","error":{"details":null,"type":"api_error","message":"Internal server error"},"request_id":"req_zyb7mkprl3cmjfkxcgdyqc7vfb5acwc42mmtbpnkv7oegld4xo3q"}
[DEBUG] [API REQUEST] /model/<inference-profile-arn>/invoke source=agent:builtin:general-purpose
[ERROR] API error (attempt 1/11): 500 The system encountered an unexpected error during processing. Try your request again.
... (10 more identical retries, each 1–50s apart)
[ERROR] Error in API request: 500 The system encountered an unexpected error during processing. Try your request again.
[Stall] tool_dispatch_end tool=Agent outcome=ok durationMs=263366
User-facing surfacing:
API Error: 500 The system encountered an unexpected error during processing. Try your request again.
This is a server-side issue, usually temporary — try again in a moment.
agentId: a3ac06a00e2524e83
<usage>total_tokens: 0 tool_uses: 0 duration_ms: 263366</usage>
Cross-checked against AWS CloudWatch (`AWS/Bedrock` namespace, dimension `ModelId=t1futowidw7s`, failure window): zero `InvocationServerErrors`, zero `InvocationClientErrors`, zero `InvocationThrottles`. The 12 failed retries do not appear in `Invocations` either — only successful main-thread calls are counted.
Steps to Reproduce
- Configure Claude Code with Bedrock and an Opus 4.7 application inference profile in EU (a cross-region profile spanning multiple EU regions, in my case).
- Auth via
AWS_BEARER_TOKEN_BEDROCK. - Open any session — confirm the main thread is working (it will be).
- From the main thread, invoke the Agent tool:
````
Agent({ subagent_type: "general-purpose", prompt: "anything — even a 10-word prompt reproduces" })
- Observe ~4 minutes of retries followed by
API Error: 500withagentIdfor resume. - In the same session, the following all succeed on the same auth and inference profile:
- main-thread tool calls
Agent({ subagent_type: "Plan", ... })Agent({ subagent_type: "Explore", ... })(note: Explore uses Haiku)- plugin subagents such as
claude-code-guide
To capture the underlying error: run /debug first, then reproduce, then grep ~/.claude/debug/<session-id>.txt for [ERROR] and Internal server error.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.138
Platform
AWS Bedrock
Operating System
Ubuntu/Debian Linux
Terminal/Shell
VS Code integrated terminal
Additional Information
Main thread was spawning subagents in a session, a couple worked, then suddenly none worked. I asked it to run diagnostics and this ticket is the outcome.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗