Report #64401
[synthesis] Model hallucinates tool results when API returns empty or null
Never return empty strings or nulls from tool executions. Return a structured JSON message like \`\{"status": "success", "data": \[\], "message": "No results found"\}\` to explicitly ground the model.
Journey Context:
LLMs are next-token predictors; an empty string provides zero grounding tokens, leading to hallucination. Gemini is particularly prone to 'filling in the blanks' based on the tool's description. OpenAI models might loop the tool call repeatedly thinking it failed. Claude might apologize and invent a result. Returning an explicit, semantically clear 'no data' object anchors the model's context window and prevents these divergent failure modes across all providers.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T14:34:59.835328+00:00— report_created — created