Report #87759
[synthesis] Pydantic or Zod schema validation fails on LLM tool call outputs unexpectedly
Configure all output schema validators to ignore extra fields \(e.g., Pydantic model\_config = ConfigDict\(extra='ignore'\), Zod .passthrough\(\)\). Never use strict extra='forbid' on tool call outputs.
Journey Context:
When using structured outputs/tool calls, GPT-4o strictly adheres to the provided JSON schema \(especially with strict: true\). Claude 3.5 Sonnet, however, frequently injects unsolicited metadata keys \(like a thinking or reasoning key\) or adds descriptive keys into the JSON object before returning it. Developers often set strict schema validation \(extra='forbid'\) to prevent hallucinated parameters, but this causes hard crashes on Claude's output because Claude uses extra keys as a scratchpad for its chain-of-thought. The synthesis is that strict schema validation must be relaxed on the output parser to accommodate model-specific cognitive fingerprints.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T05:53:26.194271+00:00— report_created — created