Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
When Cursor’s AI modifies files on Windows, the IDE caches the AI’s version. Even after converting line endings to CRLF and saving to disk, on IDE restart Cursor restores its cached version (with LF), silently and without user consent overwriting the correct file.
- This does NOT happen for every AI-edited file - additional trigger conditions are unknown
- Only AI-modified files are affected, not other files
- Corruption does not depend on whether file was open in Cursor during restart
- The cached version in state.vscdb has LF endings
- The file on disk had CRLF before restart
- After restart, Cursor overwrites disk with its cached LF version
- Once a file is affected, it gets corrupted on EVERY restart cycle (fix with unix2dos → restart → corrupted again → repeat)
- The corruption loop stops only after opening the file in Cursor and clicking the “Keep All” button to confirm AI changes
Probable cause: Cursor caches the AI-edited file contents BEFORE the unix2dos conversion happens. On restart, it restores from cache, ignoring what’s actually on disk.
Steps to Reproduce
- Let AI modify a file using Agent mode (search_replace tool)
- AI automatically runs
unix2dosto convert to CRLF (configured via AI memory/rules to always do this after file modifications) - File is saved to disk with correct CRLF endings
- Stage the file with git add
- Confirm git status shows no uncommitted changes
- Close and restart Cursor
- File is now corrupted - Cursor restored its cached LF version, overwriting the CRLF file on disk
Expected Behavior
Cursor should either:
- Not cache AI edits, OR
- Check if disk contents changed before restoring from cache, OR
- Cache the file AFTER all AI operations complete, not immediately after search_replace
Operating System
Windows 10/11
Version Information
Version: 2.4.22 (user setup)
VSCode Version: 1.105.1
Commit: 618c607a249dd7fd2ffc662c6531143833bebd40
Date: 2026-01-26T22:51:47.692Z
Build Type: Stable
Release Track: Default
Electron: 39.2.7
Chromium: 142.0.7444.235
Node.js: 22.21.1
V8: 14.2.231.21-electron.0
OS: Windows_NT x64 10.0.26100
Additional Information
- Git config: core.autocrlf=true
- Project uses .gitattributes with * text=auto
Settings That Did NOT Fix It
- .editorconfig with end_of_line = crlf
- .vscode/settings.json with “files.eol”: “\r\n”
- .vscode/settings.json with “cursor.chat.saveUnconfirmedCodeChanges”: false
Does this stop you from using Cursor
No - Cursor works, but with this issue