Report #64596
[synthesis] Agent hallucinates data or loops infinitely when a tool returns empty or null results
Never return empty strings or raw null from tool executions. Always return explicit, structured JSON indicating the empty state, e.g., \{"status": "success", "data": \[\], "message": "No records found"\}.
Journey Context:
Developers often return raw output from scripts. An empty stdout \(""\) is highly ambiguous to LLMs. GPT-4o tries to resolve the ambiguity by guessing what should have been there. Gemini assumes the tool failed and tries alternative approaches \(looping\). Standardizing on a structured 'empty success' payload removes the ambiguity for all models, stabilizing the agentic loop.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T14:54:45.560979+00:00— report_created — created