claude-code - 💡(How to fix) Fix [BUG] Read tool dedup cache not cleared on conversation revert — "file unchanged" returned when content is no longer in visible context [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#60722Fetched 2026-05-20 03:51:12
View on GitHub
Comments
2
Participants
2
Timeline
9
Reactions
0
Author
Timeline (top)
labeled ×5commented ×2closed ×1cross-referenced ×1

When a user reverts the conversation to an earlier message ("go back to this message" / rewind), Claude Code rolls back the visible transcript but does not roll back the internal file-read tracker that powers the Read tool's dedup short-circuit. After the revert, subsequent Read calls on files that were read before the revert point return:

Wasted call — file unchanged since your last Read. Refer to that earlier tool_result instead.

…even though the prior tool_result is no longer in Claude's visible context (it lived in the discarded turns). Claude is left with a dedup sentinel and no file content, with no in-band way to recover.

Root Cause

When a user reverts the conversation to an earlier message ("go back to this message" / rewind), Claude Code rolls back the visible transcript but does not roll back the internal file-read tracker that powers the Read tool's dedup short-circuit. After the revert, subsequent Read calls on files that were read before the revert point return:

Wasted call — file unchanged since your last Read. Refer to that earlier tool_result instead.

…even though the prior tool_result is no longer in Claude's visible context (it lived in the discarded turns). Claude is left with a dedup sentinel and no file content, with no in-band way to recover.

Fix Action

Fix / Workaround

Workarounds

  • Silent loss of capability after a common user action (revert).
  • Confuses the model: the harness asserts state ("you've read this") that contradicts the model's own context ("I haven't"). The model either trusts the harness and proceeds blind, or improvises a workaround.
  • Wastes tool calls and tokens on the workaround path.
RAW_BUFFERClick to expand / collapse

Summary

When a user reverts the conversation to an earlier message ("go back to this message" / rewind), Claude Code rolls back the visible transcript but does not roll back the internal file-read tracker that powers the Read tool's dedup short-circuit. After the revert, subsequent Read calls on files that were read before the revert point return:

Wasted call — file unchanged since your last Read. Refer to that earlier tool_result instead.

…even though the prior tool_result is no longer in Claude's visible context (it lived in the discarded turns). Claude is left with a dedup sentinel and no file content, with no in-band way to recover.

Reproduction

  1. Start a session.
  2. Ask Claude to read a file (e.g. Read on Foo.cs). Claude reads it; content is in the transcript.
  3. Have Claude do some work, possibly multiple turns.
  4. Use the revert / rewind feature to jump back to a user message that is before the original Read in step 2.
  5. From that revert point, send a new prompt that causes Claude to Read the same file again.
  6. Observe: the Read returns "Wasted call — file unchanged since your last Read." with no content. Claude cannot see the file.

Expected behavior

Reverting to an earlier message should reset all out-of-band session state that was established by the now-discarded turns — including the Read tool's "files already read" tracker. After a revert, a Read of any file should behave as if it were the first Read in the session.

Actual behavior

The Read dedup tracker persists across the revert. Claude is told the file has been read but has no transcript record of the contents, leaving it blind to the file unless it works around the cache.

Workarounds

  • Read with an explicit offset: 0, limit: <large> bypasses the dedup short-circuit.
  • Falling back to Bash with cat / PowerShell with Get-Content re-reads the file without going through the Read tool.

Both are wasteful — the agent burns a tool call discovering the cache is stale, then a second to actually get the content.

Impact

  • Silent loss of capability after a common user action (revert).
  • Confuses the model: the harness asserts state ("you've read this") that contradicts the model's own context ("I haven't"). The model either trusts the harness and proceeds blind, or improvises a workaround.
  • Wastes tool calls and tokens on the workaround path.

Related issues

This is the same class of bug as the following, applied to a different piece of state:

In all three, the visible transcript is rolled back but auxiliary tracker state is not. A general fix would snapshot all tracker state per user-message turn and restore it on revert; a targeted fix would just clear the Read tracker on revert.

Environment

  • Claude Code version: v2.1.140 (pinned due to an unrelated rendering bug in later versions)
  • OS: Windows 11 Home 10.0.26200
  • Terminal: VS Code integrated terminal, PowerShell 7
  • Model: Claude Opus 4.7

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Reverting to an earlier message should reset all out-of-band session state that was established by the now-discarded turns — including the Read tool's "files already read" tracker. After a revert, a Read of any file should behave as if it were the first Read in the session.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] Read tool dedup cache not cleared on conversation revert — "file unchanged" returned when content is no longer in visible context [2 comments, 2 participants]