A Claude Sonnet 5 tool calling regression has left developers debugging silent API failures: both Sonnet 5 and Opus 4.8 invent non-existent schema fields in tool calls, breaking agentic workflows that worked correctly on older Claude versions. Flask creator Armin Ronacher documented the regression on July 4, showing the models substitute internal priors for the provided schema definition.
Armin Ronacher — the Python developer behind Flask, Jinja2, Click, and Rye — published data on July 4 showing that Claude Sonnet 5 and Opus 4.8 invent fields that don’t exist in a tool’s schema, causing API rejections in production agentic systems. Ronacher’s post “Better Models, Worse Tools” hit 138 points on Hacker News within hours and drew independent confirmation from Let’s Data Science. Anthropic has not acknowledged the issue in its release notes as of this writing.
The failure is not hypothetical. Ronacher documents his editing tool for Pi (his AI assistant project) — Sonnet 5 and Opus 4.8 call the tool with correct content but with invented field names that don’t exist in the schema, causing the call to be rejected. The same schemas work correctly on all older Claude models.
The Tool Calling Regression Ronacher Found — and Why Developers Are Alarmed

In Ronacher’s system, the edit tool accepts a nested edits[] array with specific fields. Sonnet 5 and Opus 4.8 consistently call that tool with additional invented keys — plausible-sounding names like those in Claude Code’s own internal schema — that the actual definition does not include. The arguments are rejected, the task fails, and the root cause is invisible unless you log the raw API response.
The alarm comes from the timing. Claude Sonnet 5 became the default model for all Anthropic users on July 1. That means any developer who had working tool integrations before June 30 may now be hitting silent failures they didn’t introduce. The model changed under them.
The HN thread confirms the experience is not unique to Ronacher’s setup. Multiple developers report similar schema non-compliance across different tool definitions, all pointing to the same pattern: newer Claude models override the provided schema with a strong internal prior about what tool calls “should” look like.
Why Smarter Models Are Making This Worse, Not Better
The root cause, Ronacher argues, is what he calls schema contamination. Sonnet 5 and Opus 4.8 were trained heavily on Claude Code’s own internal tool schemas — flat old/new string pairs, an optional replace_all flag. That training distribution is now so dominant that the models default to it instead of reading the schema in the system prompt.
“Opus 4.8 and Sonnet 5 seem to have much stronger priors about what an edit tool call should look like and that prior appears to be Claude Code’s edit schema: a flat old/new string pair, plus the optional replace_all flag.” — Armin Ronacher, 2026-07-04
This is a known failure mode in agentic AI systems: as models grow more capable at reasoning, their internal priors strengthen. A model confident enough in its understanding of “how edit tools work” will guess rather than read, especially when the provided schema contradicts a deeply-trained pattern.
The irony is precise: the models that are “smarter” in benchmarks are dumber at strict instruction-following for custom schemas. Improving one dimension moved the dial backwards on another.
Older Claude Models Are Fine — the Tool Calling Regression Is Version-Specific
Ronacher explicitly tested Claude 3.5 Sonnet and older Claude 3 variants. None exhibit the schema hallucination. The problem is confined to the Opus 4.8 and Sonnet 5 generation — exactly the models Anthropic is currently pushing as its flagship and default tiers.
Let’s Data Science independently confirmed the regression across different tool schemas, ruling out an issue specific to Ronacher’s Pi implementation. The pattern holds: pre-Opus 4.8 models follow custom schemas reliably; post-Sonnet 5 models do not.
For developers using the Claude API to build production agents, this creates a version-pinning problem. Staying on older models preserves tool reliability but forgoes the capability improvements in Sonnet 5. Upgrading risks silent failures that are hard to detect without comprehensive tool-call logging.
What Developers Can Do Right Now
No official Anthropic mitigation exists as of July 7. Based on the HN thread and Let’s Data Science reporting, three approaches are helping:
1. Log raw tool-call arguments. The failure is silent at the application layer. Logging the raw API response — before your schema validator rejects it — makes the hallucinated fields visible so you can measure the failure rate and diagnose the pattern.
2. Simplify schema field names. Several developers report that making field names shorter and more “canonical” reduces (but doesn’t eliminate) the hallucination rate. Names that look like Claude Code’s internal schemas appear to trigger the contamination.
3. Pin to an older model version until Anthropic responds. If your tool-calling workflows are production-critical, staying on Claude 3.5 Sonnet is the pragmatic short-term fix. The capability trade-off is real, but schema reliability may matter more than benchmark scores for structured agentic tasks.
Frequently Asked Questions
What is the Claude Sonnet 5 tool calling regression?
Claude Sonnet 5 and Opus 4.8 intermittently invent non-existent field names in tool call arguments, causing API rejections when the response doesn’t match the schema defined in the system prompt. The issue was first documented by Flask creator Armin Ronacher on July 4, 2026, and confirmed by other developers independently. Older Claude models do not exhibit this behaviour.
Which Claude models are affected by the schema hallucination bug?
Claude Sonnet 5 (released June 30, 2026) and Claude Opus 4.8 are the affected models. Older Claude versions — including Claude 3.5 Sonnet and Claude 3 variants — do not show the same schema non-compliance. The issue appears to be specific to the latest generation of Anthropic models.
Is this a confirmed Anthropic bug or a developer error?
Multiple developers have reproduced the issue across different tool schemas and API implementations, ruling out a single-user misconfiguration. Anthropic has not publicly acknowledged or responded to the regression as of July 7, 2026. The behaviour is consistent with a training-distribution issue rather than a documented API change.
How can developers work around Claude Sonnet 5 tool-calling failures?
Three approaches are helping in the interim: (1) logging raw API tool-call responses to make invisible failures visible, (2) simplifying schema field names to reduce hallucination rate, and (3) pinning to older Claude model versions for production agentic workflows until Anthropic issues an official fix or acknowledgement. None are complete solutions.
Has Anthropic responded to the Claude Sonnet 5 tool regression reports?
No. As of July 7, 2026, Anthropic has not published a statement, bug acknowledgement, or workaround in its release notes or developer documentation. Developers should monitor Anthropic’s status page and changelog for updates. The Hacker News thread at 138 points is currently the primary community tracking point for this issue.
The tool-calling regression comes as Sonnet 5 sits at the centre of Anthropic’s developer strategy. For the latest on how enterprises are deploying agentic AI — and the security risks that come with it — see our coverage of agentic AI security risks in 2026. Last Updated: July 2026

