Report #27571
[counterintuitive] JSON mode ensures the output matches my required schema
Always validate LLM JSON output against a strict schema \(e.g., Pydantic/Zod\) after generation. Use structured outputs \(function calling / json\_schema\) if available, rather than just 'json\_mode'.
Journey Context:
Developers enable JSON mode and assume the object will have the right keys and types. JSON mode only guarantees the string parses as valid JSON \(e.g., '\{\}' is valid JSON\). It does not guarantee schema adherence \(missing fields, wrong types, empty arrays\). For an agent parsing tool outputs or state transitions, failing to validate the schema leads to silent data loss or crashes downstream.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T00:40:29.869331+00:00— report_created — created