Files are overwritten with zero length at startup

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

When Cursor IDE launches, it starts saving and syncing project files, which is visible in the notifications at the bottom and the file modification times. For some reason, Cursor Agent Windows launched and started doing something for a long time until it froze. The Open Cursor IDE button didn’t launch IDE. I ended up having to close the process through Task Manager. The next time I launched it, the same thing happened. The third time, everything launched, but I discovered that about 700 files had zero length. Subsequent analysis showed that these changes occurred within almost one second of launch. This is a specific issue. I didn’t have a full new backup; I managed to restore from a partial old backup and from local history, but I’m not completely sure that previous dialogs and formula changes were restored correctly. What should I do and how can I avoid this in the future?

Steps to Reproduce

Close IDE when launched in Task Manager.

Operating System

Windows 10/11

Version Information

Version: 3.12.29 (system setup)
VS Code Extension API: 1.128.0
Commit: cd1c87ff9b66021918fb9731605f8d1d5fd2f0b0
Date: 2026-07-21T03:26:05.811Z
Layout: IDE
Build Type: Stable
Release Track: Nightly
Electron: 40.10.3
Chromium: 144.0.7559.236
Node.js: 24.15.0
V8: 14.4.258.32-electron.0
xterm.js: 6.1.0-beta.256
OS: Windows_NT x64 10.0.22631

Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

Hey, thanks for the detailed report. Losing files always hurts, I’m sorry.

What happened here: when Cursor starts, it can bulk re-save files that still have unaccepted agent edits (inline diffs), those “Saving / Writing into file” messages at the bottom. On Windows this save is non-atomic, so if you kill the process via Task Manager during that “storm”, some files can end up truncated to zero bytes. This is a known issue on our side, and I can’t share an ETA for a fix yet.

Recovery:

  • Local History (Timeline panel) is the right tool, and you already used it. Going forward, the most reliable option is git with regular commits, it’ll get you out of situations like this.

How to reduce risk until it’s fixed:

  • Before closing Cursor, accept or reject all pending agent edits Review changes → Keep All / Undo All. The re-save storm on startup only affects files with unaccepted inline diffs.
  • Don’t kill the process via Task Manager while the save notifications are active at startup. Let them finish.
  • Important: files.autoSave and files.hotExit don’t disable this write path, so don’t rely on them.

Also, the Agents Window freeze on startup that forced you into Task Manager is a separate issue. If it happens again, message me and we’ll dig in. Let me know how the recovery goes.

Are you saying I had at least 700 pending changes (given that 700 files were affected) and that what I restored from my local history isn’t up-to-date, and all my edits still need to be found, tested, and re-applied?

Two quick clarifications to your questions.

The 700 files are not 700 edits you made. They’re files with unresolved inline diffs that build up from session to session. Storm rewrote them with identical content, and the zeroing came from an interrupted write, not from lost edits. So you don’t need to re-find and re-apply changes. You just need the latest valid version of each file.

For bulk recovery doing it one by one via Timeline really is not r
ealistic:

  • With git: git restore . will restore all zeroed files back to the last commit in one go. This is the fastest path.
  • Without git: Local History is stored on disk at %APPDATA%\Cursor\User\History\ (each subfolder is one file, entries.json plus snapshots). From there you can use a script to extract the latest non-empty snapshot. Before you do that, make a copy of the History folder.

Let me know if you get stuck with the disk-level path.

Thank you. I already wrote in the first message that I restored it.

I discovered that this is all due to the Agents window being open, which resets files in all open projects (probably during indexing). Even if I close all project folders (dialogs) in the left-hand menu, one dialog still remains open.
How can I disable the Agents window?

Hey @Matthew_Hernandez thanks for getting back to me with the details. A couple of clarifications on your last question.

The file rewrites aren’t coming from the Agents Window or indexing. They’re coming from restoring pending agent edits unaccepted inline diffs on startup. So closing the Agents Window won’t prevent it. Files with unaccepted diffs still get hit by the startup re-save.

Good news, a fix is already in progress and should land in one of the next updates any version newer than 3.15.6. After that, Cursor will stop rewriting files on startup when the contents haven’t changed. That means the storm that cut your files down to zero goes away.

Until you update, the most reliable protection is what I mentioned above. Before closing Cursor, accept or reject all pending agent edits Review changes → Keep All or Undo All. Also don’t kill the process via Task Manager while startup save notifications are still showing.

If the startup freeze that forced you to use Task Manager happens again on the new version, post here and we’ll dig into it separately.

24 days and still not fixed.
Had it happen 3 times to me these past 2 weeks.
Each time it costs me a lot of credits to restore stuff, I can never be totally sure if everything is restored and it costs me hours everytime…

Hey @skaro, thanks for reaching out. Losing files really sucks, especially multiple times in a row.

A couple things that can help right now:

Recovery without credits. You don’t need to run the agent to get files back, that’s just wasted usage. If your project is in git, git restore . will bring all zeroed files back to the last commit in one command, instantly. If you don’t use git, Local History is stored on disk at %APPDATA%\Cursor\User\History\ (make a copy of that folder first, then you can pull the latest non-empty snapshot).

How to reduce the risk before you update:

  • Before closing Cursor, accept or reject all pending agent edits: Review changes → Keep All / Undo All. The startup storm only grabs files that still have unresolved inline diffs.
  • Don’t kill the process in Task Manager while the save notifications at the bottom are still active on startup. Let them finish.
  • files.autoSave and files.hotExit don’t disable this write path, so don’t rely on them.

One important question: what Cursor version are you on Cursor > About? Part of this issue (rewriting byte-identical files on startup) is fixed in versions newer than 3.15.6. If you’re below that, please update. If you’re already on a newer version and files still get zeroed, that’s a different case we’re tracking, and I need your version and OS so I can pass it to the team correctly.

Share your version and we’ll dig in from there.

Hello,
I am well aware of how to use git, it is in between commits the permanent losses can happen.
In order to actually restore lost changes in those cases the only valid way is to replay all changes from transcripts based on HEAD.
This is not a straightforward process and using AI is the only way unless I do it myself and spend days maybe weeks to actually restore things. With AI powers I can do it in some hours.
I have had at least 50 files zeroed out and their entire timeline (local history) overwritten by zeroed checkpoints multiple times.
My codebase is like 300-400k lines so there is also that.

I am running on 3.18.9 and have had it happen once.
It happened twice on version 3.15.X something.

I am using Linux distro:
Pop!_OS 24.04 (based on Ubuntu).

If you are losing changes in between making Git commits, I would first suggest committing your changes more often. Commit to a dev branch and then merge changes later into the main branch, or even just commit changes to your local repository and don’t push to a remote repository until you’ve finished whatever item you’re working on.

If that’s not an option for whatever reason, then accepting or rejecting pending agent edits (as Dean Rie said) can prevent Cursor trying to replay those edits later. It’s worked for me before. Also, “git stash” lets you save your pending changes and return the working tree to HEAD without committing anything. You can do that before closing Cursor each time. Then when you next start Cursor, confirm that the working tree is still clean and run “git stash pop” to restore the stashed changes. Then you can be sure that nothing was lost, and you don’t have to spend hours trying to redo lost work.

@skaro, got it, and sorry. Losing work between commits, especially when Local History snapshots get overwritten with zeros, really sucks.

Quick version difference: the part fixed in builds newer than 3.15.6 was the re-save storm, where files with identical content were rewritten on startup. But what you’re seeing on 3.18.9 zeroed files plus Local History snapshots being rewritten as empty is a separate issue we’re tracking. Thanks for sharing the version and OS. The detail about Local History getting zeroed is especially important, I’ll pass that to the team.

So we can track your case cleanly and not mix it with the already closed part, please start a new thread in Bug Reports with these details: version 3.18.9, Pop!_OS 24.04, about 50 files, Local History zeroed, and your codebase size. If you can remember, a couple of extra details would really help:

  • Did this happen right after updating Cursor, or on a normal cold start?
  • Was there a freeze or hang on startup that made you force quit the process?
  • When you closed Cursor, did you have any unresolved agent edits pending, like Review changes showing a non-zero file count?

For reducing risk for now yes, this isn’t a replacement for git, but it helps avoid this path:

  • Before closing Cursor, accept or reject all pending agent edits: Review changes → Keep All / Undo All. The startup re-save seems to hit files with unresolved inline diffs.
  • Don’t kill the process via the task manager while you still see save notifications on startup. Let them finish.
  • Don’t rely on files.autoSave or files.hotExit here, they don’t disable this write path.

Send the link to the new thread and we’ll dig in there.