[BUG] tools.N.custom.defer_loading: Extra inputs are not permitted (400) when MCP tools are configured
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?
Claude Code 2.1.49 throws a 400 API error when MCP tools are configured and the dynamic tool loading feature (tengu_tool_pear) is active. The tool serializer writes defer_loading: true directly into the API payload, but the Anthropic API's strict schema validation rejects it as an unknown field inside the custom tool sub-object.
What Should Happen?
defer_loading should either:
- Be gated behind the appropriate beta header (same pattern as
input_examples), or - Be stripped from the payload before the API call and used only as a client-side hint
Error Messages/Logs
API Error: 400 {"error":{"message":"{\"message\":\"tools.21.custom.defer_loading:
Extra inputs are not permitted\"}. Received Model Group=claude-sonnet-4-6\n
Available Model Group Fallbacks=None","type":"None","param":"None","code":"400"}}
Steps to Reproduce
In the tool serialization function (xPR in the embedded bundle), defer_loading: true
is unconditionally written into the API tool payload when R.deferLoading is truthy:
if (R.deferLoading) B.defer_loading = !0;
deferLoading is set to true for any MCP tool when the dynamic tool loading feature
flag is active:
deferLoading: q && (DE(GT) || aK8(GT))
// DE(GT) returns true for all MCP tools (isMcp === true)
The defer_loading field ends up inside the custom sub-object when the API
processes the tool array. Since defer_loading is not part of the custom tool
schema, the API rejects it with "Extra inputs are not permitted".
By contrast, other conditional fields like input_examples are correctly gated
behind a beta header check:
if (R.betas?.includes(ZaT) && T.input_examples) B.input_examples = T.input_examples;
.0
defer_loading is missing an equivalent guard.
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.49
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗