[Bug] Excessive cache writes causing unexpectedly high token usage and costs
Unexpected excessive cache reads/writes causing $94.46 charge during simple repository inspection
Summary
While using Claude Code for a relatively simple task involving gathering information from a local repository, the session unexpectedly generated millions of cache reads and cache writes, resulting in a $94.46 charge.
This behavior seems abnormal and possibly related to repeated failed requests or retry behavior. I have been using Claude Code for a long time and have not seen this type of cache usage or cost pattern before.
I would like help investigating whether this was caused by a bug.
Environment
- Platform: macOS / darwin
- Terminal: VS Code
- Claude Code version: 2.1.185
- Feedback ID: 476d44e0-a293-4d4d-9eeb-9c396c4d3426
What happened
Claude Code was asked to gather information from the repository. During this process, usage spiked unexpectedly, with extremely high cache read and cache write counts. The resulting cost was $94.46, which seems far beyond what should be expected for this type of task.
The logs also show repeated 400 invalid_request_error failures related to reddit.com being inaccessible to Anthropic’s user agent. It looks like these failures may have been retried multiple times.
Error logs
[
{
"error": "Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"The following domains are not accessible to our user agent: ['reddit.com']. Read more: https://support.anthropic.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler\"},\"request_id\":\"req_011CcJARPCUUZTDz4TQTSvPi\"}\n at generate (/$bunfs/root/src/entrypoints/cli.js:12:68924)\n at makeRequest (/$bunfs/root/src/entrypoints/cli.js:52:7688)\n at processTicksAndRejections (native:7:39)",
"timestamp": "2026-06-22T10:45:40.842Z"
},
{
"error": "Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"The following domains are not accessible to our user agent: ['reddit.com']. Read more: https://support.anthropic.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler\"},\"request_id\":\"req_011CcJARPqBLQyZKiiWJrfA1\"}\n at generate (/$bunfs/root/src/entrypoints/cli.js:12:68924)\n at makeRequest (/$bunfs/root/src/entrypoints/cli.js:52:7688)\n at processTicksAndRejections (native:7:39)",
"timestamp": "2026-06-22T10:45:40.980Z"
}
]
The full log contains many repeated errors of the same form.
Expected behavior
A simple repository information-gathering task should not generate millions of cache reads/writes or result in a $94.46 charge.
If an external domain is inaccessible, Claude Code should fail gracefully, avoid repeated expensive retries, and avoid creating excessive cache traffic.
Actual behavior
The task appears to have triggered repeated failed requests and extremely high cache activity, leading to an unexpectedly large charge.
Requested help
Could you please investigate:
- Whether this was caused by a Claude Code bug, retry loop, or cache accounting issue.
- Why repeated
reddit.comaccess failures led to such high cache reads/writes. - Whether safeguards can be added to prevent this from happening again.
- Whether a refund or credit can be issued for the unexpected $94.46 charge.
Thank you.
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗