Malformed tool calls leaking into chat + disproportionate usage-limit consumption on Opus (regression, ~1 week)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Two connected issues observed in a single long-running Claude Code session (multi-day, large project):
1) Tool calls intermittently fail to parse — the raw/unparsed tool-call text leaks directly into the chat as visible text instead of executing, and the intended action (file edit, command, etc.) does not happen. This requires manual retries. It started specifically ~1 week ago and occurred repeatedly over several days, specifically while using the Opus model.
2) Starting at the same time, usage-limit consumption became wildly disproportionate to actual work done. Concretely: a normal working cycle on Opus consumed ~50% of a 5-hour Pro plan limit, and immediately after, a single plain-text question with zero tool calls on Sonnet consumed ~9% of the 5-hour limit. One week earlier, this same (already large) session was consuming quota economically. Conversation size did not grow dramatically in that week, so simple "context got too big" does not explain a sudden step-change in cost — growth in cost should be gradual/proportional to growth in size, not a sudden cliff.
Suspected connection: reliable handling of large histories usually depends on reusing/caching already-processed context, billing full price only for new increments. It's possible issue (1) is corrupting that reuse mechanism — e.g. unstable/garbled content injected into history during failed attempts and retries — forcing full-price reprocessing of the entire history on every subsequent turn instead of a cached/discounted rate.
What Should Happen?
- Tool calls should parse and execute reliably, or fail with a clear, non-leaking user-facing message — never dump raw call syntax into the visible chat.
- Usage-limit consumption per turn should scale roughly proportionally with conversation growth. A session that was economical a week ago at nearly the same size should not suddenly consume 50%+ of a 5-hour limit in one cycle, or 9% for a single plain-text question.
Error Messages/Logs
Your tool call was malformed and could not be parsed. Please retry.
Steps to Reproduce
This is an emergent issue in a long-running session rather than a clean minimal repro — noting honestly:
- Run Claude Code in one continuous session for multiple days, with heavy file editing across a sizeable project (many files, many tool calls accumulated in history).
- Continue using the same session for a week+; note that usage cost stays economical/predictable during this period.
- At some point (in our case: after ~1 week, on the Opus model), tool calls begin intermittently failing to parse, requiring retries.
- Compare usage-limit consumption before/after this point using
/cost— observe a disproportionate spike relative to visible work, despite conversation size not increasing dramatically.
I don't have a minimal isolated reproduction — this appears tied to long-session state, not a specific short input.
Claude Model
Not sure / Multiple models
Is this a regression?
Yes, this worked in a previous version
Last Working Version
Unknown exact version — this same session was working reliably and economically approximately one week ago; issue emerged since then.
Claude Code Version
Using Claude Desktop app (Windows) and mobile app — exact version number not visible in the app UI, checked Settings/About.
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Other
Additional Information
Suspected root cause is a breakdown in context caching/reuse triggered by the malformed-tool-call bug, not simple context-size growth — see reasoning in "What's Wrong?". Happy to provide more session detail if useful, though the session itself is not shareable due to project content.