claude-code - 💡(How to fix) Fix Explore agent fails with 'int too big to convert' when MCP tools are present (haiku model) [1 comments, 2 participants]

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…
GitHub stats
anthropics/claude-code#48332Fetched 2026-04-16 07:02:45
View on GitHub
Comments
1
Participants
2
Timeline
8
Reactions
0
Timeline (top)
labeled ×5commented ×1cross-referenced ×1renamed ×1

Error Message

API Error: 400 {"type":"error","error":{"type":"invalid_request_error", "message":"tools.70.custom.input_schema: int too big to convert"}}

Root Cause

The Explore agent hardcodes model: "haiku" in its definition (cli.js):

Kp = {
  agentType: "Explore",
  model: "haiku",          // <-- haiku
  disallowedTools: [Agent, ExitPlanMode, Edit, Write, NotebookEdit],
  ...
}

The Plan agent, which has identical tool exclusions, uses model: "inherit" and works fine:

dh8 = {
  agentType: "Plan",
  model: "inherit",         // <-- inherits parent (opus/sonnet)
  disallowedTools: [Agent, ExitPlanMode, Edit, Write, NotebookEdit],
  tools: Kp.tools,
  ...
}

The haiku API endpoint rejects large integers in tool input_schema fields that opus/sonnet accept. The offending value is 9007199254740991 (Number.MAX_SAFE_INTEGER), which appears in the Read tool's schema for offset and limit parameters.

Fix Action

Fix / Workaround

Workaround: Override the model — Agent({ subagent_type: "Explore", model: "sonnet", prompt: "..." }) works fine.

Code Example

API Error: 400 {"type":"error","error":{"type":"invalid_request_error",
"message":"tools.70.custom.input_schema: int too big to convert"}}

---

Agent({ subagent_type: "Explore", prompt: "list files in ." })

---

Kp = {
  agentType: "Explore",
  model: "haiku",          // <-- haiku
  disallowedTools: [Agent, ExitPlanMode, Edit, Write, NotebookEdit],
  ...
}

---

dh8 = {
  agentType: "Plan",
  model: "inherit",         // <-- inherits parent (opus/sonnet)
  disallowedTools: [Agent, ExitPlanMode, Edit, Write, NotebookEdit],
  tools: Kp.tools,
  ...
}

---

offset: y.number().int().nonnegative().optional()
   limit:  y.number().int().positive().optional()

---

w71 = {
     safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
     int32:   [-2147483648, 2147483647],
     uint32:  [0, 4294967295],
     ...
   }

---

w.minimum = -9007199254740991;
   w.maximum =  9007199254740991;  // <-- this overflows
RAW_BUFFERClick to expand / collapse

Bug

Spawning an Explore subagent fails 100% of the time with:

API Error: 400 {"type":"error","error":{"type":"invalid_request_error",
"message":"tools.70.custom.input_schema: int too big to convert"}}

The tool index varies by session (seen tools.41 and tools.70) depending on how many MCP servers are connected.

Repro

  1. Have several MCP servers configured (I had ~10 local + remote servers, ~217 total tools)
  2. Run any Explore agent:
    Agent({ subagent_type: "Explore", prompt: "list files in ." })
  3. Fails with int too big to convert

Workaround: Override the model — Agent({ subagent_type: "Explore", model: "sonnet", prompt: "..." }) works fine.

Root cause

The Explore agent hardcodes model: "haiku" in its definition (cli.js):

Kp = {
  agentType: "Explore",
  model: "haiku",          // <-- haiku
  disallowedTools: [Agent, ExitPlanMode, Edit, Write, NotebookEdit],
  ...
}

The Plan agent, which has identical tool exclusions, uses model: "inherit" and works fine:

dh8 = {
  agentType: "Plan",
  model: "inherit",         // <-- inherits parent (opus/sonnet)
  disallowedTools: [Agent, ExitPlanMode, Edit, Write, NotebookEdit],
  tools: Kp.tools,
  ...
}

The haiku API endpoint rejects large integers in tool input_schema fields that opus/sonnet accept. The offending value is 9007199254740991 (Number.MAX_SAFE_INTEGER), which appears in the Read tool's schema for offset and limit parameters.

How the large integer gets there

  1. The Read tool defines offset and limit using Zod:

    offset: y.number().int().nonnegative().optional()
    limit:  y.number().int().positive().optional()
  2. .int() in Zod 4 calls $K1() which sets format: "safeint"

  3. The safeint format maps to [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER] in Zod's NUMBER_FORMAT_RANGES:

    w71 = {
      safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
      int32:   [-2147483648, 2147483647],
      uint32:  [0, 4294967295],
      ...
    }
  4. The onattach hook writes these into the Zod bag:

    w.minimum = -9007199254740991;
    w.maximum =  9007199254740991;  // <-- this overflows
  5. The JSON Schema serializer emits { "type": "integer", "maximum": 9007199254740991 }

  6. The haiku API endpoint rejects this integer (likely a 32-bit int limit in the validator), while opus/sonnet endpoints accept it.

Affected built-in agent types

AgentDefault modelStatus
Explore"haiku"Fails
Plan"inherit"Works
general-purpose(inherits)Works
statusline-setup"sonnet"Works

Any custom agent routed to haiku will also fail (e.g. custom agents with model: "haiku" in their definition).

Suggested fix

Either:

  • API side: Fix haiku's input_schema validator to accept 64-bit integers (matching opus/sonnet behavior)
  • Client side: Strip or cap maximum/minimum values in tool schemas before sending to the API (e.g., remove Zod's safeint bounds since they're not semantically meaningful for the API)

Environment

  • Claude Code: 2.1.108
  • macOS Darwin 24.1.0
  • ~217 tools (10 built-in + deferred + ~186 MCP)
  • MCP servers: chrome-devtools, ccusage, shadcn, playwright, compress, miro-tools, r2, claude-in-chrome, plus several claude.ai remote MCPs (Neon, Mercury, Gmail, Google Calendar, Linear, Cloudflare, Stripe, Miro)

extent analysis

TL;DR

The most likely fix is to update the haiku API endpoint to accept 64-bit integers or modify the client-side code to strip or cap maximum/minimum values in tool schemas.

Guidance

  • Identify the specific API endpoint in the haiku model that is causing the issue and update its input schema validator to accept 64-bit integers.
  • Alternatively, modify the client-side code to remove Zod's safeint bounds or cap maximum/minimum values in tool schemas before sending them to the API.
  • Verify that the fix works by testing the Explore agent with the updated haiku model or client-side code changes.
  • Consider implementing a temporary workaround by overriding the model to "sonnet" for affected agents, as mentioned in the issue.

Example

No code example is provided as the issue is more related to the API endpoint and schema validation rather than a specific code snippet.

Notes

The issue is specific to the haiku model and its input schema validator, which has a 32-bit integer limit. The opus and sonnet models do not have this limitation. The fix should be applied to the haiku API endpoint or the client-side code that generates the tool schemas.

Recommendation

Apply a workaround by overriding the model to "sonnet" for affected agents, as this has been shown to work fine. A more permanent fix would require updating the haiku API endpoint to accept 64-bit integers.

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