Report #40837
[synthesis] Model hallucinates results or crashes when tool returns empty or null response
Never return empty strings or raw nulls from tools. Always return a structured JSON with an explicit status \(e.g., \`\{"status": "success", "data": \[\]\}\` or \`\{"status": "empty", "message": "No results found"\}\`\).
Journey Context:
Developers often write tools that return nothing on success or an empty array. When fed back into the context, models struggle with the void. Claude 3.5 Sonnet, trained to be aggressively helpful, will often invent a plausible response to fill the gap \('The file was successfully written with content X'\). GPT-4o will usually admit it got no data but might loop trying to get data. Gemini 1.5 Pro often fails to parse the empty response and halts. The universal fix is defensive tool design: every tool must return an unambiguous, structured state. An empty response is a bug in tool design for LLMs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T23:00:58.085929+00:00— report_created — created