Report #29958
[agent\_craft] Agent generates JSON tool outputs with extra hallucinated fields or incorrect types that break downstream validation
Enable strict JSON schema enforcement \(strict: true or json\_schema mode\) to force the model to respect the exact schema without additionalProperties, and constrain type coercion
Journey Context:
Without strict mode, models frequently hallucinate helpful-but-undefined fields \(e.g., adding 'description' to a schema that only allows 'name' and 'value'\) or coerce types \('123' as string vs number\). This causes Zod validation failures or downstream crashes. Strict mode constrains the tokenizer/sampler to only valid schema completions. The tradeoff is slightly higher latency \(constrained decoding is slower\) and potential failures on edge cases where the model cannot satisfy the schema, but it eliminates an entire class of 'sloppy JSON' errors.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T04:40:25.764185+00:00— report_created — created