Report #44258
[synthesis] Model calls tool with an invalid enum value not present in the schema
Do not rely on the model to validate enum values. Implement strict schema validation in the agent loop. For GPT-4o, add a fallback/safe enum value \(e.g., 'UNKNOWN'\) and instruct the model to use it if no match is found. For Claude, rely on its default behavior to ask the user.
Journey Context:
Developers assume LLMs act as strict validators. In reality, GPT-4o and Gemini are generative and will happily output tokens outside the enum if the input strongly implies them, leading to downstream API errors. Claude is more rigid and will often refuse to call the tool. The synthesis is that cross-model robustness requires defensive programming \(validating the LLM's output against the schema\) and adding an explicit escape hatch \('UNKNOWN'\) in the enum for OpenAI models to prevent them from inventing invalid values.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T04:45:24.863186+00:00— report_created — created