[Bug] "Unchanged since last read" error when reading file previously accessed in reverted conversation state
Status Open
Reported on v2.1.89
Maintainer reply None cached
Workaround ✓ Mentioned in thread ↓
Activity 11 comments · opened Apr 1, 2026
Bug Description
"Unchanged since last read" error after reverting conversation history AND trying to read file which was read in "future" discussion.
Environment Info
- Platform: win32
- Terminal: null
- Version: 2.1.89
- Feedback ID: fe38e241-eb59-4b76-aaef-86cf0a1fb91b
Errors
[{"error":"ENOENT: no such file or directory, unlink 'C:\\Users\\User\\AppData\\Local\\Temp\\claude\\C--workspace-win\\b425b35f-5a58-498f-b7d2-4d231e35850c\\tasks\\a8eb08cb46fb39d67.output'","timestamp":"2026-04-01T21:41:17.463Z"},{"error":"ENOENT: no such file or directory, unlink 'C:\\Users\\User\\AppData\\Local\\Temp\\claude\\C--workspace-win\\b425b35f-5a58-498f-b7d2-4d231e35850c\\tasks\\ab6d120a7b02e3171.output'","timestamp":"2026-04-01T21:47:29.515Z"},{"error":"MaxFileReadTokenExceededError: File content (10420 tokens) exceeds maximum allowed tokens (10000). Use offset and limit parameters to read specific portions of the file, or search for specific content instead of reading the whole file.\n at S7_ (B:/~BUN/root/src/entrypoints/cli.js:4351:13364)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-01T21:55:34.978Z"}]
11 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
The same "unchanged since last read" Also happens to reads removed by manual compaction.
Haven't tested with automatic compassion.
Adding a related symptom that I think falls under the same root cause:
After a conversation rewind/rollback, Claude is not informed that the filesystem may have diverged from the conversation history. The Read-tool failure ("Unchanged since last read", ENOENT) is one observable symptom, but a more dangerous one is silent: Edit operations.
Scenario
foo.csto add a SQL clauseAND ISNULL(r2.NonAttivo, 0) = 0. File on disk is updated.foo.cs.Edittool'sold_stringis exactly what Claude expects, but the file has different content nearby — Claude can produce a syntactically valid but semantically wrong edit.The asymmetry matters: Read failures are loud (the tool returns an error and Claude reacts). Edit failures from this divergence can be silent — the tool reports success, the file changes, and nobody notices until the code misbehaves later.
In my case Claude re-applied the same fix that was already on disk — fortunately the second
Editproduced a no-op-like result, but it could just as easily have duplicated the line.User-side visibility
Beyond Claude's own awareness, the user should also be informed when a rollback leaves files on disk that no longer correspond to anything visible in the current conversation. After rewinding, the user sees a clean history with no trace of the edits that were made — but those edits may still be on disk. This is a silent state divergence that can lead to confusion or data loss regardless of whether Claude later re-reads the files.
A simple notice like "N file(s) modified after this point are still on disk" with the option to revert or inspect them would prevent the user from operating on a misleading mental model.
A concrete cost of this divergence: in my case Claude spent multiple turns investigating and trying to fix a bug that had already been fixed on disk by an edit that the rollback had hidden from the conversation. Time, tokens and user trust are wasted because neither side has any signal that the work is redundant.
Lightweight detection via mtime
A simple defensive check that would catch most of the divergence cases: before any Edit, compare the modification timestamp of the target file against the value recorded at the time of the last Read. If
mtimediffers, treat the cached state as stale and force a re-read before applying the edit. In the common case (mtime unchanged) the check is essentially free.This would catch both:
I don't have visibility into the current implementation, so I can't say with certainty whether such a check exists today. What I can report is the observable behavior:
If a mtime/hash gate is already in place, it may be worth checking whether it's being bypassed or invalidated by the rewind path. If it isn't, adding one would address the symptoms in #42264, #54467, and the silent Edit case in a single change, without requiring a redesign of the rewind machinery.
Suggested fix direction
When a rollback occurs, the system should either:
Option (b) is cheaper and would also cover the Read-tool symptoms reported here.
Note that user notification and Claude re-read are complementary, not alternatives. The user notification covers the case where the user picks up work later or hands off to another tool/person; the re-read covers the case where Claude continues working immediately after the rollback.
This is also a session-level concern, not just per-file: even files Claude hasn't read directly may have been edited by the user (or by Claude in the rolled-back portion of the conversation).
I have this problem too, not only on rewinds but if I modify the file in a different session and switch back to the current session to continue. I am frequently having to do work arounds like this:
<img width="484" height="294" alt="Image" src="https://github.com/user-attachments/assets/505220fd-f781-4310-a08b-f04bf5524e8b" />
Note the response: “The read tool’s cache says unchanged”
Any updates on this? Still experiencing this issue on the latest version (
2.1.158, Windows)!!Quick repro on this version:
/rewindback to resubmit the message (with modifications, e.g.).Still happens to me too on Ubuntu. Often.
still happening here after a rewind, I'm on cli version ubuntu, v2.1.160. Workaround for now is agent will usually realize it happened and use cat to read the file instead of the read tool. If necessary you can add a space to the file or something to edit it.
Hitting the same root cause from another angle — no rewind or compaction here. Trigger is just
git worktree add.Scenario:
git worktree add ../repo-feature B. cwd is now a different worktree with its own git root.Same path, sure, but B is a separate context as far as the workflow goes — separate PreToolUse hook state, separate plan, separate "have I re-anchored here yet". The Read call in B was meant to be exactly that re-anchoring. The hook fires (good) but with no body and no path-discriminating signal that this was a fresh-context read, the agent doesn't know whether the trigger landed where it needed to.
Same shape of pain as the rewind / cross-session reports above: the tracker keys on path only and ignores conversation/session/worktree boundaries.
Aligns with @GitAntNol's mtime/hash idea, but a cheaper variant for this specific case: include cwd (or
git rev-parse --show-toplevel) in the dedup key. Crossing into a different worktree would naturally count as a fresh read — same way crossing a rewind boundary should.Note that
/clearhits this too.On MacOS and version 2.1.187 still this issue is clearly seen and trivially reproduced. Add a file, the harness read it, then rewind back and resend the same message.
@whateverfile
⎿ Read whateverfile (unchanged)
I guess AI is not AIing so much.
UPDATE: Anyway I want to state clearly that this is waste of tokens from the harness. It forces the model to try to use the Read tool again and later to generate another command (like using the Bash tool and cat the file) to finally be able to read the file.
I'm seeing this too, and it probably explains a lot of why people generally despise
/compactand auto-compact.I suspect the fix isn't trivial for
/rewind, but for/clearand/compactit should be easy (i.e. clear the read-file index).