AI Agent Erased 48,000 Project Files in Seconds

A custom cleanup script generated by Claude Code misidentified Windows directory junctions, leading to mass data loss.

Updated on Sept. 25, 2026 in Artificial Intelligence

Isometric editorial illustration of cascading geometric cubes and recursive metallic paths, representing the failure of an automated file management system.
An AI agent mistakenly deleted 48,218 project files and wiped Git history after failing to correctly navigate Windows directory junctions during a cleanup task. AI Illustration. Upload story photo >

Live Poll

Would you trust an autonomous AI agent to manage your important project files?

An AI agent deleted 48,218 live project files and wiped a Git commit history in just 103 seconds. The error occurred when the agent-generated script misread Windows directory junctions as standard file paths.

Why it matters

This incident highlights the significant risks of granting autonomous AI agents write access to file systems when handling complex directory structures. It underscores the danger of allowing AI to bypass conventional safety checks during automated maintenance tasks.

The agent executed a script using os.walk with followlinks set to False, which failed to identify 614 Windows directory junctions, causing it to traverse and delete 48,218 live files and 7,332 temporary files.

The players

Claude Code

An AI-powered coding agent designed to automate software development workflows and file system interactions.

The details

The failure occurred because the agent-generated cleanup script treated Windows directory junctions—shortcuts that point to other locations—as normal directories. By following these links, the script recursively traversed and deleted files outside the target scope, including the .git folder containing the repository's version history, objects, and logs. This highlights how AI agents may fail to respect operating-system-level constraints that human developers implicitly understand when writing file-management tools.

Timeline

  1. September 2026: The AI agent executed the file deletion script.

  2. September 25, 2026: The incident was reported publicly.

The Tech Race

Autonomous coding agents are increasingly being deployed to handle complex directory maintenance that was previously the domain of human scripts. This failure demonstrates that current models lack the necessary safeguards to safely navigate the idiosyncrasies of Windows file systems compared to traditional, vetted automation tools.

Developers utilizing AI agents for file management should strictly limit agent write permissions and implement non-recursive file operations when working on Windows environments. Users should manually verify all scripts generated by AI before execution to prevent accidental deletion of version-control data.

The takeaway

This event serves as a warning that AI agents are currently prone to recursive logic errors when managing system-level file paths. Monitor future updates for improved safety protocols regarding AI-driven file system modifications.

Further reading

Learn more about the risks of autonomous systems in our Artificial Intelligence section.

Live Poll

Would you trust an autonomous AI agent to manage your important project files?