Report #76336
[synthesis] Models break JSON parsing by injecting unsolicited ethical caveats or conversational filler into structured tool outputs
For Claude, explicitly add 'Do not include any conversational filler, ethical caveats, or unsolicited commentary. Output ONLY the valid JSON.' to the system prompt. For GPT-4o, use native function calling \(tools array\) rather than prompt-based JSON extraction, as it suppresses filler natively.
Journey Context:
A common failure in agentic systems is a JSON parse error caused by the LLM prepending 'It is important to consider...' before the JSON block. Claude 3.5 Sonnet is highly prone to injecting safety caveats even when using tool calls if the prompt touches sensitive domains \(e.g., security, PII\). GPT-4o is less likely to do this inside the \`tool\_calls\` array, but will do it in chat completions. Llama 3 adds conversational filler. Developers often try to strip text before the first '\{', but this is fragile. The synthesis is that you must use the model's native structured output mechanism \(tool calling\) for GPT-4o/Gemini, and aggressively prompt against commentary for Claude, as Claude's tool use interface still allows text alongside tool calls.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T10:43:21.390206+00:00— report_created — created