anthropics / anthropics/claude-code

[BUG] Prompt cache expires during active session, causing massive token spikes on next prompt

Open
#93,918 0 comments 0 reactions 0 assignees View on GitHub
area:core area:cost duplicate platform:vscode platform:windows
Dominant language
Python
Stars
145k
Forks
23.1k
PR merge metrics
PR metrics pending

Description

### Preflight Checklist

- [x] I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) 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?

2 days i see new message: Idle xxx minutes. The prompt cache has likely expired, so your next message will re-cache about 629k tokens.

### What Should Happen?

No idle count or cache expired as before!!
I don't wanna waste tokens on a bugged software working 2 minutes and then hit a 5h limit!

Pro-subscription, Opus 5

### Error Messages/Logs

```shell

```

### Steps to Reproduce

In not even long session just continue to work

### Claude Model

Opus

### Is this a regression?

Yes, this worked in a previous version

### Last Working Version

10 September 2026

### Claude Code Version

2.1.270

### Platform

Anthropic API

### Operating System

Windows

### Terminal/Shell

VS Code integrated terminal

### Additional Information

_No response_

Contributor guide

No contributing guide indexed for this repository

Research direction

No repository file or test is named. Reproduce on Windows in the VS Code integrated terminal with Claude Code 2.1.270 by continuing a session until the idle/cache-expired message appears, then compare with the 10 September 2026 version. Done means active sessions no longer report cache expiry or trigger the reported token recache.

Written by the indexing model from the issue text.

Assessment

Domain
ai, api
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.