Report #71580
[synthesis] Agent hallucinates tool results or crashes when a tool returns an empty string or null
Never return empty strings or null from tool implementations; always return a meaningful status string \(e.g., 'Success: No output' or '\{\}'\). GPT-4o tends to hallucinate a plausible result if the tool output is empty, Claude throws an API error or stops generation, and Gemini attempts to retry the tool call.
Journey Context:
A subtle but devastating bug in agentic loops is the empty tool response. If a tool executes successfully but returns "" or null, models diverge wildly. GPT-4o assumes the tool failed to return data and hallucinates what the data should have been, leading to silent fact corruption. Claude often interprets an empty response as an API error and halts. Gemini might loop, calling the tool repeatedly. The fix requires standardizing tool output wrappers in the agent framework to guarantee non-empty, structured returns.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T02:43:41.788902+00:00— report_created — created