PSA: Claude Code has two cache bugs that can silently 10-20x your API costs — here's the root cause and workarounds
TL;DR Highlight
Two Claude Code cache bugs can silently raise API costs 10-20x
Who Should Read
A developer using Claude Code with API billing who often runs --resume and has seen costs suddenly jump
Core Mechanics
- Bug 1: string replacement in the standalone binary
- The post claims Anthropic's custom Bun fork has a native-layer string replacement.
- If history contains a specific sentinel string, the wrong occurrence gets replaced.
- Message content changes every request, which breaks the cache prefix.
- When the sentinel shows up
- It appears when reading Claude Code source.
- It appears when discussing billing headers.
- It also applies if it sits in CLAUDE.md.
- Bug 2: --resume always breaks cache since v2.1.69
- Every resume causes a full cache miss on the whole conversation history.
- The cause is said to be deferred_tools_delta ordering differing between fresh and resumed sessions.
- Cost blowup on the resume request
- Only the system prompt is cached and everything else is rebuilt from scratch.
- The post says cost on that request can rise 10-20x.
- Workaround for bug 1: use npx
- Run via npx instead of the standalone binary.
- The post gives no workaround for bug 2.
Community Reactions
How to Apply
- Switch to npx today
- If you use the standalone binary, run Claude Code via npx instead.
- Run the same task and compare API usage and cost in the console.
- Audit CLAUDE.md for sentinel-related content
- Search for billing header or Claude Code internals text in CLAUDE.md.
- Use npx instead of standalone when working on those topics.
- Check cost before using --resume
- On v2.1.69 or later, check the cost of the first request after resume.
- For long sessions, compare against starting fresh and passing a summary.
Try It
# Paste into terminal (the post's workaround: run via npx instead of the standalone binary)
npx @anthropic-ai/claude-codeTerminology
Related Papers
A Beginner's Guide to Local AI with Inkling, Qwen, and Unsloth
Install Unsloth Desktop, load a quantized Qwen model, and share a private ChatGPT-like AI on your home LAN.
Muru – AI-assisted Rust server for Python apps by mod_WSGI's creator
mod_wsgi's creator is building Muru, an AI-assisted Rust ASGI/WSGI server, documenting it in public
87% of the Anthropic power will come from gas and 11% from coal in 2028
Analysis of Anthropic's contracted data centers: 87% gas, 11% coal power in 2028
Anthropic’s Nasdaq debut
Anthropic listed on Nasdaq and closed its first day below its opening price.
OpenAI still has a WebRTC Problem
WebRTC drops late audio, hurting voice AI; MoQ retransmits and buffers instead
Gemini 4 Neon
Gemini 4 Neon cuts cost per task 32% versus Carbon, at $3 input and $15 output per million tokens
AI is killing All About Berlin
After Google AI Overviews, a Berlin guide site lost 70-75% of its traffic.
Not Everything Needs an LLM
PostHog used small decision models to skip 98.7% of expensive LLM calls