Report #70281
[counterintuitive] json mode guarantees schema
Always validate LLM JSON output against a strict schema \(e.g., Pydantic/Zod\) and implement retry logic; \`response\_format: \{ type: json\_object \}\` only guarantees valid JSON syntax, not that it matches your required keys or data types.
Journey Context:
Developers enable JSON mode and assume the output will have the correct fields. JSON mode just forces the tokens to form valid syntax \(matching brackets/quotes\). The model can easily omit required keys, add hallucinated keys, or put strings where integers belong. Structured outputs \(like \`json\_schema\` type\) are better, but even then, application-level validation is strictly necessary to prevent downstream parsing errors.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T00:33:08.209200+00:00— report_created — created