Deferred tool schemas are not restored after context compaction, causing repeated InputValidationError
Preflight
- Searched existing issues for
ToolSearch deferred schema,compaction tool schema,InputValidationError required parameter,deferred tool schema lost. - Closest existing reports are #36518 (closed, intermittent "required parameter missing" on
Read/Edit/Bash) and #895 (Write/content). Both concern always-loaded builtin tools, so schema availability does not explain them. This report is specifically about tools whose schema is only obtainable viaToolSearch.
Summary
When a tool's schema is deferred (loaded on demand via ToolSearch) and the conversation is compacted after that schema was loaded, subsequent calls to the tool fail repeatedly with the same validation error. The call shape appears to be reconstructed from memory, reverting to a plausible-but-wrong form.
Observed
AskUserQuestion requires a top-level questions array. In one long session after compaction, the same failure recurred 7 times:
InputValidationError: AskUserQuestion failed due to the following issue:
The required parameter `questions` is missing
Two shapes recurred:
- Calling the tool with no parameters at all.
- Passing
question/optionsat the top level without thequestionswrapper — i.e. the singular form, which is the more common shape across tool APIs generally.
Why this looks like schema availability rather than a one-off model error
- The failure is not random. It is a consistent reversion to one specific wrong shape.
- It appears only after compaction. While the schema is present in context, the calls are well-formed — including several correct calls later in the same session once the schema was re-loaded.
- The wrong shape matches the generic/common convention for similar tool APIs, which is what you would expect from reconstruction rather than from reading a schema.
Impact
Each occurrence costs a full round-trip, and the error message states what is missing but not the required structure, so retries tend to repeat the same guess. In a long session this compounds.
Suggested direction
Either of:
- (a) On compaction, re-inject the schemas of deferred tools that were already used in the session.
- (b) Emit a compaction-time note listing which previously-loaded deferred schemas are no longer in context, so the agent knows to re-run
ToolSearchbefore calling them.
(b) seems cheaper and is probably sufficient — the failure mode is not knowing the schema is gone.
A smaller, independent improvement: include the expected parameter structure in the InputValidationError message. That would let a single retry succeed even without either fix above.
Environment
Claude Code CLI, macOS.