Critical Bug: Undo Operation Deletes Entire File Content

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Critical Bug: Undo Operation Deletes Entire File Content

Summary

When performing an Undo operation (Cmd+Z or Ctrl+Z) in Cursor IDE, the entire file content is deleted, resulting in a completely empty file. This is a critical bug that causes data loss.

Steps to Reproduce

  1. Open a file in Cursor IDE and make some edits
  2. Perform an Undo operation (Cmd+Z / Ctrl+Z)
  3. Result: The entire file content is deleted, leaving an empty file

Expected Behavior

  • Undo should only revert the last edit operation
  • File content should never be completely deleted

Actual Behavior

  • All file content is deleted
  • Without Git, the work is permanently lost
  • This has occurred multiple times

Environment

  • OS: macOS 15.7.4 (Build 24G517)
  • Shell: zsh
  • Cursor Version: (Please check Help → About)
  • File Type: Python files (.py), but may affect other file types
  • File Size: Occurs with various file sizes, possibly more frequent with larger files

Impact

  • Severity: :red_circle: CRITICAL - Causes data loss
  • Frequency: Recurring issue (happened multiple times)
  • Data Loss: Yes - Work is lost without Git recovery

Workaround

  • Use Git to restore the file: git restore <filename>
  • Commit frequently to prevent data loss
  • Manually save (Cmd+S) before performing Undo operations

Additional Notes

  • This bug has occurred multiple times in the same session
  • It seems to happen more frequently after complex editing operations or with larger files
  • The file still exists on disk (can be restored via Git), but the editor shows it as empty
  • This is a severe issue that needs immediate attention as it directly impacts user productivity and data safety

Request

Please prioritize fixing this bug as soon as possible. Data loss is a critical issue that severely impacts user trust and productivity.


Report This Bug

Recommended Channel (Fastest Response):

Alternative Channel:

Note: According to the Cursor team, the forum is the main site for bug reports and provides the fastest response.

Steps to Reproduce

  1. Open a file in Cursor IDE and make some edits
  2. Perform an Undo operation (Cmd+Z / Ctrl+Z)
  3. Result: The entire file content is deleted, leaving an empty file

Note: This has occurred multiple times, especially after complex editing operations or with larger files.

Operating System

MacOS

Version Information

Version: 2.4.37 (Universal)
VSCode Version: 1.105.1
Commit: 7b9c34466f5c119e93c3e654bb80fe9306b6cc70
Date: 2026-02-12T23:15:35.107Z
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: Darwin arm64 24.6.0

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, this is a known issue. Undoing or rejecting agent changes can sometimes delete the whole file instead of rolling back.

Main thread with details: Rejecting suggested changes can delete the entire file

A fix is already out. Please update Cursor to the latest version (Help > Check for Updates).

If your file is already gone, here are a few ways to restore it:

  • Checkpoints: Open the chat where the agent made changes, find the message right before the deletion, then click Restore Checkpoint.
  • Git: git checkout -- <file_name>
  • Timeline: In Explorer (bottom-left), pick the last working version of the file.

Let me know if it happens again after updating.

1 Like

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