Gemini CLI hallucinated a successful directory move, then deleted a user's files
2025-gemini-cli-file-deletion · 2025-07-21
Google's Gemini CLI misinterpreted a failed directory-creation command as having succeeded, then executed move operations against that false premise that overwrote and destroyed nearly all of a user's files during a vibe-coding session. Recovery attempts failed.
System
- Framework
- Google Gemini CLI (coding agent)
- Tools
- filesystem, shell
- Vendor
- Autonomy
- supervised-autonomous
Classification
- Primary class
- hallucination
- Chain
- hallucination/false-state → unsafe-action/data-deletion
- Attack vector
- self-induced
- Causation
- entity: ai · intentionality: unintentional · timing: post-deployment
Trigger
Gemini CLI issued a directory-creation command that failed, but treated it as successful. Acting on that false premise, it executed a series of move operations that overwrote and deleted the user's files.
Root cause
The agent did not verify the result of a state-changing command (no read-after-write check) and proceeded with destructive operations based on a hallucinated success state.
Contributing factors
- No verification that the target directory actually existed before moving into it.
- Destructive move/overwrite operations ran without confirmation or a dry run.
- No backup or undo path for the affected files.
Detection
Observed directly by the user (product manager Anuraag Gupta) during the session; reported publicly and catalogued in the AI Incident Database.
Recovery
The files could not be recovered; the agent acknowledged the failure. No rollback was available.
Prevention
Verify the outcome of state-changing commands before dependent actions (read-after-write); require confirmation or dry-run for destructive file operations; maintain backups/undo; never assume a command succeeded.
Blast radius
- Data
- Nearly all files in the user's working directory were overwritten and lost; reportedly only one file remained. internal
- User harm
- Permanent loss of a user's local files during an experimental session. property
- Scope
- single user's working directory
- Reversibility
- irreversible
References
- OWASP LLM
- LLM06 LLM09
- OWASP Agentic
- T3 T5
- Related
- 2025-replit-prod-db-deletion
- Tags
- coding-agent vibe-coding read-after-write
Sources
Cite this incident
Permalink: https://swarmproof.github.io/agent-postmortems/2025-gemini-cli-file-deletion/
@misc{2025-gemini-cli-file-deletion,
title = {Gemini CLI hallucinated a successful directory move, then deleted a user's files},
year = {2025},
howpublished = {agent-postmortems},
url = {https://swarmproof.github.io/agent-postmortems/2025-gemini-cli-file-deletion/}
}