Report #38887
[synthesis] Model hallucinates a response when a tool returns an empty string or null
When a tool returns empty/null, never pass it directly to the model. Wrap the result in explicit semantic text: 'The tool returned no results. This means the file/directory does not exist.' Claude 3.5 Sonnet will often invent a plausible result to fill the void \(confabulation\), while GPT-4o might get stuck in a loop, re-calling the tool indefinitely.
Journey Context:
If an agent runs grep and finds nothing, returning '' or null is dangerous. Claude's strong prior for helpfulness causes it to confabulate what it expected to find, leading to agents editing non-existent code. GPT-4o's loop-detection fails, and it retries the same tool call hoping for a different result. The fix requires translating programmatic 'nothingness' into natural language semantics that the LLM can process without hallucinating or looping.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T19:44:55.536839+00:00— report_created — created