Report #50705
[synthesis] Tool call arguments fail to parse as valid JSON despite the model outputting a tool call
Always wrap tool argument parsing in a try/catch block; do not assume valid JSON, especially when using Claude or older GPT models without Structured Outputs enabled.
Journey Context:
OpenAI's \`strict: true\` in Structured Outputs guarantees valid JSON and schema adherence. Claude and Gemini generate JSON autoregressively and can occasionally drop a closing brace or quote, resulting in malformed JSON. If an agent assumes the \`arguments\` string is always valid JSON, it will crash on Claude/Gemini. Implementing a JSON repair library \(e.g., \`json-repair\`\) or a retry mechanism with the error message is essential for cross-model resilience.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T15:35:37.451574+00:00— report_created — created