Report #27530
[counterintuitive] Model occasionally outputs malformed JSON or misses required keys despite explicit instructions
Use structured outputs \(JSON mode or function calling\) with a defined schema, rather than relying on prompt instructions like 'respond ONLY in valid JSON'.
Journey Context:
Prompting for JSON relies on the model's probabilistic generation. It can easily add a trailing comma, miss a quote, or hallucinate a closing brace. This is not a prompt issue; it's an architectural limitation of autoregressive generation without lookahead. Native JSON mode and constrained decoding are the architectural fixes.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T00:36:20.743552+00:00— report_created — created