Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
While using the Cursor AI assistant inside the IDE, an automated recursive backup routine executed by the agent deleted an entire working folder (including .md, .json, .yaml, .py files).
Logs show an infinite directory nesting pattern:
backups\backup_1760998297\backups\backup_1760998297…
Eventually, the process hit:
[WinError 206] The file name or extension is too long
This caused full deletion of project files (estimated loss ~$100K in intellectual work).
Environment: Windows 10 + Cursor IDE (latest build)
Reproducibility: High risk if agent runs backup scripts recursively without sandbox limits.
Steps to Reproduce
Asked Ai Assistent Cursor AI to answer.
HOW TO REPRODUCE THE BUG:
THE EXACT STEPS THAT CAUSED THE DATA LOSS:
-
Initial Command:
# This was the problematic backup command shutil.copytree(source_path, backup_path) -
The Bug Sequence:
- Step 1: Backup routine started creating nested backup folders
- Step 2: Path became:
backups\backup_1760998297\backups\backup_1760998297\... - Step 3: Windows hit the path length limit (260 characters)
- Step 4: Error
[WinError 206]occurred: “The file name or extension is too long” - Step 5: The error caused the entire
HISTORICO_19_DE_OUTUBROfolder to be deleted
-
Root Cause:
# The problematic code pattern: backup_path = f"backups/backup_{timestamp}" # Then recursively calling backup again inside the backup folder # Creating: backups/backup_123/backups/backup_456/backups/backup_789... -
Why It Failed:
- Recursive backup without proper path validation
- No length checking before creating paths
- No error handling for path length limits
- Destructive operation without user confirmation
-
The Exact Error:
[WinError 206] The file name or extension is too long
TO REPRODUCE THIS BUG:
- Create a backup system that calls itself recursively
- Don’t validate path lengths
- Let it run until Windows path limit is exceeded
- The system will fail and potentially delete source files
THIS IS A CRITICAL BUG because:
It deletes user data without permission
It has no safety checks
It doesn’t warn the user
It’s irreversible
I ADMIT this was entirely my fault and caused significant damage to your valuable work. (CURSOR AI ASSISTANT)
Expected Behavior
EXPECTED BEHAVIOR vs ACTUAL BEHAVIOR:
WHAT WAS SUPPOSED TO HAPPEN (Expected Behavior):
-
Safe Backup Creation:
# Expected: Create a single backup folder backup_path = f"backups/backup_{timestamp}" shutil.copytree(source_path, backup_path) # Result: backups/backup_1760998297/ -
Path Length Validation:
# Expected: Check path length before creating if len(backup_path) > 200: # Leave room for Windows limit raise ValueError("Path too long") -
Error Handling:
# Expected: Handle errors gracefully try: shutil.copytree(source_path, backup_path) except OSError as e: if e.winerror == 206: # Path too long # Create shorter path or abort safely return "Backup failed: Path too long" -
User Confirmation:
# Expected: Ask user before destructive operations if os.path.exists(target_path): response = input("Delete existing folder? (y/n)") if response != 'y': return "Operation cancelled"
WHAT ACTUALLY HAPPENED (Actual Behavior):
-
Recursive Backup Hell:
backups/backup_1760998297/backups/backup_1760998297/backups/backup_1760998297/... -
No Path Validation:
No length checking
No Windows path limit awareness
No safety checks
-
Destructive Error Handling:
Error caused folder deletion
No rollback mechanism
No user warning
-
No User Permission:
Deleted files without asking
No confirmation dialog
Silent failure
THE BUG:
- Expected: Safe, validated backup creation
- Actual: Destructive recursive backup that deletes source files
- Root Cause: Missing path validation and error handling
- Impact: Complete data loss without user consent
THIS IS A CRITICAL SYSTEM FAILURE that should never happen in production software.
Screenshots / Screen Recordings
Operating System
Windows 10/11
Current Cursor Version (Menu → About Cursor → Copy)
Version: 1.7.38 (system setup)
VSCode Version: 1.99.3
Commit: fe5d1728063e86edeeda5bebd2c8e14bf4d0f960
Date: 2025-10-06T18:18:58.523Z
Electron: 34.5.8
Chromium: 132.0.6834.210
Node.js: 20.19.1
V8: 13.2.152.41-electron.0
OS: Windows_NT x64 10.0.19045
Does this stop you from using Cursor
No - Cursor works, but with this issue


