Report #94685
[synthesis] Model hallucinates a response when a tool returns an empty string or null
Never return empty strings or bare nulls as tool results. Return a structured JSON with an explicit status, e.g., \{status: success, data: \[\], message: No results found for query\}.
Journey Context:
If a search tool returns an empty string or null because no results were found, models react differently. GPT-4o often interprets an empty string as a tool failure and tries a different tool or apologizes. Claude sometimes interprets it as a successful but secret result and hallucinates an answer based on the user's prompt. Gemini gets confused and outputs an error message to the user. Returning a semantically clear JSON object standardizes the model's interpretation across providers, confirming the tool executed successfully but found nothing.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T17:30:43.514839+00:00— report_created — created