Cursor IDE State Out of Sync with Disk

Editor shows old code after an AI edit, save says "file modified externally", or AI changes silently revert — the watcher / AI-write race, and how to fix it without losing work.

Cursor’s AI writes straight to disk, and the editor’s file watcher is supposed to notice and refresh the view. When the watcher misses an event, the editor and disk briefly disagree: you see old code while the AI’s reply already references new code, a save fails with File modified externally, one split pane is fresh and the other is stale, or AI edits flash in and then revert.

Fastest fix (do this first): if the tab has no unsaved-changes dot, run Command Palette (Cmd/Ctrl+Shift+P) -> Developer: Reload Window. Cursor reloads every file from disk and rebuilds its watchers. If the tab does have a dot, do NOT press Cmd/Ctrl+S — that flushes your stale buffer over the AI’s write. Back the buffer up first (Step 1 below), then reload.

As of June 2026 (Cursor 2.5), Anysphere has confirmed three new causes that look identical to a watcher miss but are not: an Agent Review Tab conflict, a cloud-sync race, and a Format-on-Save conflict. Run the decision table first so you fix the right one.

Which bucket are you in

SymptomMost likely causeJump to
cat file.ts in terminal shows new content, editor shows oldWatcher missed the eventCause 1
Save fails with File modified externally and tab has a dotDirty buffer vs AI writeCause 2
Two panes of the same file disagreeSplit-pane stale viewCause 3
Project is on /mnt/c, a Docker volume, or a network shareCross-FS event delayCause 4
Edits appear, then vanish a second laterAuto-save races ApplyCause 5
AI edits revert instantly, only with Review Tab openAgent Review Tab conflictCause 7
File reverts to an older version seconds after saveCloud sync (OneDrive/iCloud/Dropbox)Cause 8
Edits revert and you use Prettier/ESLint/BlackFormat-on-Save conflictCause 9
Windows only: line endings flip LF on every restartCRLF cache corruptionCause 10

Common causes

1. File watcher missed the AI write

macOS FSEvents / Linux inotify / Windows ReadDirectoryChangesW drop events under load or on network mounts. Cursor’s internal watcher also throttles. AI writes; the editor never gets a refresh notification.

How to judge: cat file.ts in a terminal shows the new content; the editor shows the old. The watcher didn’t fire.

2. Dirty buffer + AI write to disk

The tab shows a dot (unsaved buffer) while AI is writing to disk. Cmd/Ctrl+S flushes the buffer and overwrites the AI edit. Cursor usually prompts with File modified externally, but a fast manual save can let the buffer silently win.

How to judge: watch the tab dot before and after Apply. A dot during Apply is the danger sign.

3. Same file in two split panes

VS Code / Cursor allow the same file in two panes, each with its own view model. AI writes; the focused pane refreshes; the other one doesn’t.

How to judge: two panes show the same file with different contents.

4. WSL / Docker volume / network share event delay

/mnt/c/... (the WSL2 filesystem boundary), Docker Desktop bind mounts on macOS, SMB/NFS shares, and Dropbox/iCloud directories all delay or drop file events — lag of 5-30s, or never. On WSL2 specifically, inotify events do not cross the \\wsl$ boundary reliably.

How to judge: the project path matches one of the above; the same AI action does not reproduce on a native path.

5. Auto-save races Apply

With files.autoSave: afterDelay, Cursor flushes the dirty buffer after files.autoSaveDelay (default 1000 ms). If Apply lands inside that window, the stale buffer overwrites the new content.

How to judge: files.autoSave is not off; the issue timing lines up with the delay window.

6. AV / file lock briefly holds the file

Windows Defender, corporate AV, Spotlight indexing, and Time Machine scans occasionally lock a file for 200-500 ms — right inside the watcher throttle window.

How to judge: intermittent, and correlates with scan times.

7. Agent Review Tab conflict (new, confirmed early 2026)

When the same file is open in both the Agent Review Tab and a normal editor tab, edits sent via “Fix in Chat” can get reverted instantly — the Review Tab’s view model wins. Anysphere confirmed this on the Cursor forum in early 2026.

How to judge: edits appear and vanish within ~1s, and the behavior stops when you close the Agent Review Tab before prompting.

8. Cloud sync overwrites the file (new, confirmed early 2026)

OneDrive, iCloud Drive, Dropbox, and Google Drive can push an older cached copy back onto disk faster than Cursor finishes writing, so the file reverts seconds after the AI saves. Confirmed by the Cursor team in early 2026.

How to judge: the project lives inside a synced folder (OneDrive\..., ~/Library/Mobile Documents/..., Dropbox/...); the revert happens a beat after save, not during Apply.

9. Format-on-Save conflict (new, confirmed early 2026)

With editor.formatOnSave on plus Prettier, ESLint, or Black, the formatter rewrites the file right after the AI write and can clobber the AI’s changes. Note formatOnSave does not fire under files.autoSave: afterDelay, which is its own source of “saved but not formatted” confusion.

How to judge: disabling Format on Save (or running cursor --disable-extensions) stops the reverts.

10. Windows CRLF cache corruption on restart (new)

Windows 10/11 only: Cursor caches the AI-edited content (with LF) in state.vscdb before the line-ending conversion completes. On the next restart it restores that cached LF snapshot over your CRLF file — silently, even if the file was closed. files.eol and .editorconfig do not stop it.

How to judge: line endings flip back to LF after every restart despite repeated conversions.

Before you start

  • Confirm whether this is one specific file / time / project, or universal.
  • Commit before reproducing so revert has a baseline.
  • Note the Cursor version (Cursor -> About), OS, and filesystem (APFS, WSL ext4, Docker volume, SMB).

Info to collect

  • Cursor version, OS, filesystem type.
  • Project path — is it on WSL /mnt/, a Docker volume, a network share, or a synced folder (OneDrive/iCloud/Dropbox)?
  • files.autoSave and editor.formatOnSave settings; whether the file is open in multiple panes or in the Agent Review Tab.
  • View -> Output -> Log (Window) — look for missed event / throttled entries.

Shortest fix path

Order is: save the current file first, then prevent recurrence.

Step 1: Preserve the buffer, then reload

If the tab has a dirty dot, back the buffer up before anything else:

# macOS: select all in the editor -> Cmd+C -> then in a terminal:
pbpaste > /tmp/scratch-backup.ts

Then run Cmd/Ctrl+Shift+P -> File: Revert File. The editor drops the unsaved buffer and re-reads disk. Now diff your scratch copy against disk and merge back anything you still need.

Step 2: For a repo-wide mismatch, reload the window

Cmd/Ctrl+Shift+P -> Developer: Reload Window. Cursor reloads all files and rebuilds watchers — faster than quitting. If a single file still looks stale, click the Refresh Explorer button at the top of the Explorer panel.

Step 3: Disable auto-save during AI sessions

Settings -> search files.autoSave -> set off (or onFocusChange). Save manually after each Apply so the buffer can’t race the write.

// settings.json
{
  "files.autoSave": "off",
  "files.hotExit": "onExit"
}

Step 4: Don’t split-pane the same file, and close the Review Tab

Close the duplicate pane (Cmd/Ctrl+Shift+P -> View: Close Other Editor Group). If you use Agent Review, close the Agent Review Tab before sending a “Fix in Chat” prompt — leaving it open on the same file is the confirmed cause of instant reverts (Cause 7).

Step 5: Move the project to a native filesystem

In WSL2, /mnt/c/Users/you/repo crosses the filesystem boundary and watchers crawl. git clone into ~/repo (native ext4) is dramatically faster and more reliable. If you must stay on /mnt/c, set polling in the WSL settings:

// settings.json (WSL window)
{
  "remote.WSL.fileWatcher.pollingInterval": 1000,
  "files.watcherExclude": { "**/node_modules/**": true }
}

Docker Desktop on macOS: keep the project inside the container, or mark the bind mount cached/delegated.

Step 6: Take the project out of cloud-synced folders

If the repo lives in OneDrive, iCloud Drive, Dropbox, or Google Drive, move it out (e.g. to ~/code/repo) or exclude that folder from sync. Cloud clients restoring an older snapshot is a confirmed revert cause (Cause 8). Use git for versioning instead.

Step 7: Disable Format on Save (or isolate extensions)

Settings -> search editor.formatOnSave -> turn it off, or temporarily disable Prettier / ESLint / Black. To confirm an extension is the culprit, relaunch with:

cursor --disable-extensions

If reverts stop, re-enable extensions one at a time to find the offender.

Step 8: AV / Spotlight allowlists

Windows Defender / corporate AV -> add the project root and the Cursor install directory to exclusions. macOS Spotlight:

sudo mdutil -i off ~/path/to/repo

Or System Settings -> Spotlight -> Search Privacy and add the folder.

Step 9 (Windows only): break the CRLF cache loop

If line endings keep flipping to LF on restart, open the affected file and click Keep All to confirm the AI changes. That clears the stale snapshot in state.vscdb and stops the corruption cycle.

How to confirm it’s fixed

  • Restart Cursor and reproduce the original action — confirms it isn’t transient session state.
  • Run a fresh AI Apply on a single file with auto-save off; the editor view and cat of the file on disk should match byte for byte.
  • Try a different repo or a different machine to separate Cursor config from project state.
  • Have a teammate open the same repo — confirms it isn’t only your local cache.

If it still fails

  • Reduce the repro to one file, one AI Apply, auto-save off, Review Tab closed.
  • Roll back the most recent Cursor upgrade or settings.json change.
  • Search forum.cursor.com for “file watcher missed” / “out of sync” and include OS + filesystem.
  • Grab View -> Output -> Log (Window) and post it to the Cursor Bug Reports category.

FAQ

Why does Cursor keep showing old code after the AI clearly edited the file? The file watcher missed the write event (Cause 1). Run Developer: Reload Window to force a re-read from disk. If it recurs, your project is probably on a slow filesystem (WSL /mnt/c, Docker volume, network share).

My AI edits appear and then revert a second later. What’s wrong? That’s a revert, not a sync lag. The two confirmed culprits as of 2026 are an open Agent Review Tab on the same file (close it before prompting) and a cloud-sync client overwriting the file (move the repo out of OneDrive/iCloud/Dropbox). Format on Save with Prettier/ESLint can do the same.

Is Cmd+S safe when I see “File modified externally”? No. Saving flushes your in-editor buffer over the newer disk content. Back up the buffer (pbpaste > /tmp/backup), run File: Revert File, then merge in anything you still need.

Does turning off auto-save actually help? Yes, during AI sessions. files.autoSave: afterDelay flushes the buffer after 1000 ms by default, and if an Apply lands in that window the stale buffer wins. Set it to off and save manually after each Apply.

On Windows my files keep reverting to LF line endings. How do I stop it? This is a known cache bug where Cursor stores the pre-conversion LF copy in state.vscdb and restores it on restart. files.eol and .editorconfig won’t fix it; open the file and click Keep All to clear the cached snapshot.

How do I force-reload a single file without reloading the whole window? Cmd/Ctrl+Shift+P -> File: Revert File (this discards an unsaved buffer and re-reads disk). If the file isn’t dirty, click the Refresh Explorer button in the Explorer panel.

Prevention

  • Auto-save off during AI sessions; turn it back on afterward.
  • Don’t split-pane the same file, and close the Agent Review Tab before “Fix in Chat”. For comparisons use git diff or the Source Control view.
  • Keep projects on a native filesystem (APFS, WSL ext4, local Linux disk) and out of cloud-synced folders.
  • Add the Cursor install path and project root to AV / Spotlight allowlists.
  • Commit before and after important AI sessions — worst case, a single git reset --hard recovers everything.

Tags: #Troubleshooting #Cursor #Debug #IDE sync