Agents are deleting files while editing

Describe the Bug

Since the last update 2.1.50 the agent is unable to edit files. On multiple repeated edits to the same file, the file gets deleted. This it not the agent deleting the file. This is a bug in how Cursos does the editing. It notices that the build fails, investigates, finds out that the file is missing/empty and then tries to fully rewrite the file (which was expensive!)

Steps to Reproduce

I used the agent mode to do a edit where it needs to change multiple places (5 in my case) in the same file. It tries to do multiple small edits.

Screenshots / Screen Recordings

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.1.50
VSCode Version: 1.105.1
Commit: 56f0a83df8e9eb48585fcc4858a9440db4cc7770
Date: 2025-12-06T23:39:52.834Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Darwin arm64 25.1.0

For AI issues: which model did you use?

Tried Opus 4.5 Thinking and GPT-5.1 Codex Max

Does this stop you from using Cursor

Yes - Cursor is unusable

1 Like

Hey, thanks for the screenshot. I see auto-runs (odin fmt, odin run, git show) and a failed build, after which the Agent keeps making edits - this looks a lot like a previously observed bug.

Help us reproduce:

  • Send the Request ID(s) for the steps where the file became empty or disappeared (Chat menu top-right → Copy Request ID). Guide: Getting a Request ID | Cursor Docs
  • Confirm whether there were unfinished diffs when you sent the next message
  • Let us know if Run everything was enabled
  • Provide the file path and type, plus minimal repro steps
  • Share DevTools Console logs at the moment of the incident

Workarounds for now:

  • Work under git and explicitly Accept/Reject current diffs before sending a new message to the Agent
  • If a file disappeared, restore it via Checkpoints: Checkpoints | Cursor Docs

Similar case: Source file deleted

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.