claude-code - 💡(How to fix) Fix [BUG] /context shows 0 tokens for all MCP tools on Bedrock — countTokensWithFallback fails with 400 tools.0.custom.eager_input_streaming: Extra inputs are not permitted

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

  1. It falls back to global.anthropic.claude-haiku-4-5-20251001-v1:0 via Bedrock, which returns a 400 error for every tool group: The error tools.0.custom.eager_input_streaming: Extra inputs are not permitted suggests that Claude Code 2.1.153 sends a tool schema field (eager_input_streaming) that the Bedrock endpoint rejects as an unknown/extra field. [ERROR] Failed to resolve Bedrock inference profile backing model for global.anthropic.claude-sonnet-4-6: Request aborted [ERROR] countTokensWithFallback: fallback failed: 400 tools.0.custom.eager_input_streaming: Extra inputs are not permitted

Root Cause

The root cause, found in the debug log, is that the token counting fallback chain completely fails when running via Bedrock:

Code Example

countTokensWithFallback: fallback failed: 400 tools.0.custom.eager_input_streaming: Extra inputs are not permitted
countToolDefinitionTokens returned null for 141 tools: mcp__atlassian__addCommentToJiraIssue, ...
countToolDefinitionTokens returned null for 8 tools: Agent, AskUserQuestion, Bash, Edit, Read, Skill, ToolSearch, Write

---

[ERROR] Failed to resolve Bedrock inference profile backing model for global.anthropic.claude-sonnet-4-6: Request aborted
[ERROR] countTokensWithFallback: fallback failed: 400 tools.0.custom.eager_input_streaming: Extra inputs are not permitted
[DEBUG] countToolDefinitionTokens returned null for 141 tools: mcp__atlassian__addCommentToJiraIssue, mcp__atlassian__addWorklogToJiraIssue, ...
[DEBUG] countToolDefinitionTokens returned null for 8 tools: Agent, AskUserQuestion, Bash, Edit, Read, Skill, ToolSearch, Write
[DEBUG] countToolDefinitionTokens returned null for 1 tools: CronCreate
[DEBUG] countToolDefinitionTokens returned null for 1 tools: WebFetch
... (repeated for every tool/group)
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report
  • I am using the latest version of Claude Code (v2.1.153)

What's Wrong?

The /context command displays 0 tokens for every MCP tool (all 141 tools across atlassian, glean, azure-devops, snowflake, etc.) even after those tools have been actively used in the session. The same 0 tokens applies to all deferred tools (TaskCreate, WebFetch, CronCreate, etc.) and to the 8 built-in tools (Agent, Bash, Read, etc.).

The root cause, found in the debug log, is that the token counting fallback chain completely fails when running via Bedrock:

  1. The primary counter calls the Bedrock inference profile for global.anthropic.claude-sonnet-4-6 and gets null (with Request aborted).
  2. It falls back to global.anthropic.claude-haiku-4-5-20251001-v1:0 via Bedrock, which returns a 400 error for every tool group:
countTokensWithFallback: fallback failed: 400 tools.0.custom.eager_input_streaming: Extra inputs are not permitted
countToolDefinitionTokens returned null for 141 tools: mcp__atlassian__addCommentToJiraIssue, ...
countToolDefinitionTokens returned null for 8 tools: Agent, AskUserQuestion, Bash, Edit, Read, Skill, ToolSearch, Write

The error tools.0.custom.eager_input_streaming: Extra inputs are not permitted suggests that Claude Code 2.1.153 sends a tool schema field (eager_input_streaming) that the Bedrock endpoint rejects as an unknown/extra field.

Importantly, actual tool calls work fine — the MCP tools execute successfully (e.g. getJiraIssue completed in 1.6s). Only the token-counting side-channel is broken, which makes /context unable to display meaningful token counts for any tool.

What Should Happen?

/context should display accurate per-tool-group token counts even on Bedrock. The fallback token counting mechanism should either:

  • Not send the eager_input_streaming field when targeting a Bedrock endpoint that doesn't support it, or
  • Gracefully handle the 400 Extra inputs are not permitted and display a best-effort estimate instead of silently reporting 0 for everything.

Steps to Reproduce

  1. Configure Claude Code to use Bedrock (CLAUDE_CODE_USE_BEDROCK=1 or equivalent Bedrock routing).
  2. Start a session with multiple MCP servers connected (atlassian, glean, azure-devops, etc.).
  3. Use any MCP tool (e.g. mcp__atlassian__getJiraIssue).
  4. Run /context.
  5. Observe: all MCP tools show 0 tokens, all deferred tools show 0 tokens, built-in tools show 0 tokens.

Debug Log Evidence

[ERROR] Failed to resolve Bedrock inference profile backing model for global.anthropic.claude-sonnet-4-6: Request aborted
[ERROR] countTokensWithFallback: fallback failed: 400 tools.0.custom.eager_input_streaming: Extra inputs are not permitted
[DEBUG] countToolDefinitionTokens returned null for 141 tools: mcp__atlassian__addCommentToJiraIssue, mcp__atlassian__addWorklogToJiraIssue, ...
[DEBUG] countToolDefinitionTokens returned null for 8 tools: Agent, AskUserQuestion, Bash, Edit, Read, Skill, ToolSearch, Write
[DEBUG] countToolDefinitionTokens returned null for 1 tools: CronCreate
[DEBUG] countToolDefinitionTokens returned null for 1 tools: WebFetch
... (repeated for every tool/group)

This is repeated identically every time /context is invoked.

Environment

  • Claude Code: v2.1.153
  • Platform: Linux (WSL2, 5.15.167.4-microsoft-standard-WSL2)
  • Shell: zsh
  • Model: global.anthropic.claude-sonnet-4-6 via Bedrock
  • MCP servers connected: atlassian, glean, azure-devops, snowflake, memory

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] /context shows 0 tokens for all MCP tools on Bedrock — countTokensWithFallback fails with 400 tools.0.custom.eager_input_streaming: Extra inputs are not permitted