Report #81659
[synthesis] Agent hallucinates tool results or loops infinitely when tool returns empty or null
Never return empty strings or null from tool executions. Always return a structured JSON object with an explicit status and message, e.g., \{'status': 'success', 'data': \[\], 'message': 'No results found'\}.
Journey Context:
When a tool execution yields no results \(e.g., empty array, null, empty string\), models exhibit distinct failure signatures. GPT-4o tends to hallucinate a plausible result based on the tool's expected output to cover the empty state. Claude often throws an API error or outputs a literal 'None' string, breaking JSON parsers. Gemini gets confused and repeatedly calls the same tool in an infinite loop. The synthesis is that empty states are an unhandled edge case natively; providing explicit semantic nulls prevents GPT's confabulation, Claude's type errors, and Gemini's looping.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T19:39:59.551074+00:00— report_created — created