Bug Report: Files deleted after SSH reconnection during remote editing

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Environment:
Cursor IDE (latest version)
Remote connection via SSH
Linux host
Problem:
Files that were edited by Cursor AI agent get deleted from disk after SSH connection interruption and automatic reconnection/reload.
Steps to reproduce:
Connect to remote PC via SSH in Cursor
Open files and make edits using AI agent (StrReplace tool)
Run a command that causes SSH connection to drop (e.g., launching a program that disrupts networking)
Cursor attempts to reconnect and triggers “reload”
Result: Files that were being edited disappear from:
The filesystem (confirmed via ls and git status showing “deleted”)
Open editor tabs
Expected behavior:
Files should persist on disk. At worst, unsaved changes might be lost, but files themselves should not be deleted.
Actual behavior:
Entire files are deleted from the remote filesystem after reconnection.
Impact:
Critical - data loss. Users lose source code files.
Workaround:
Use git restore to recover deleted files if they were tracked by git.
User theory:
The issue may be related to how Cursor handles file buffers during SSH reconnection - possibly the reload process incorrectly syncs an empty/null state back to the remote filesystem.

Steps to Reproduce

Steps to reproduce:
Connect to remote PC via SSH in Cursor
Open files and make edits using AI agent (StrReplace tool)
Run a command that causes SSH connection to drop (e.g., launching a program that disrupts networking)
Cursor attempts to reconnect and triggers “reload”
Result: Files that were being edited disappear from:
The filesystem (confirmed via ls and git status showing “deleted”)
Open editor tabs

Operating System

Windows 10/11

Version Information

cursor --version
2.5.20
511523af765daeb1fa69500ab0df5b6524424610
x64

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the report. This is a known issue. We’re seeing similar reports from other users with the same pattern (SSH disconnect → reload → files deleted from disk). Here’s a related thread: Critical bug - Cursor SSH Remote physically deletes workspace files on disconnect/reconnect.

The team is aware of it. To help with debugging, if it happens again, before you run git restore, please collect, if possible:

  • SSH logs: View > Output > select “Anysphere Remote SSH” in the dropdown
  • ls -la in the directories where the files disappeared
  • cursor --list-extensions to share the list of extensions on the client

A couple questions:

  • Which SSH extension are you using, Anysphere Remote SSH or the standard VS Code Remote-SSH? If it’s the latter, you’ll need to switch to Anysphere.
  • Did you have multiple projects or folders open in the same window?

As a temporary workaround, make frequent commits and, as you already noticed, use git restore to recover. You can also set up periodic backups on the remote server (a crontab job with git stash or copying files).

Let me know if you’re able to grab the logs.

A post was merged into an existing topic: Critical bug — Cursor SSH Remote physically deletes workspace files on disconnect/reconnect (3rd occurrence)