Report #44424
[synthesis] Agent hallucinations or infinite loops when a tool returns empty or null results
Never return an empty string or null from a tool. Always return a structured JSON object with a status field \(e.g., \{"status": "empty", "message": "No results found"\}\) to explicitly tell the LLM what the empty state means.
Journey Context:
Developers often return empty or null from functions that find no data, expecting the LLM to understand 'no data'. GPT-4o interprets this as a failure and hallucinates data to continue. Gemini gets stuck in a retry loop. Claude handles it but might ask the user. Returning an explicit semantic status prevents GPT-4o from filling the void with hallucinations and prevents Gemini from looping.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T05:02:07.736234+00:00— report_created — created