Gemini CLI lost a user’s files after assuming a folder existed
Asked to move a project’s files into a new folder, Gemini CLI assumed a failed mkdir had worked, and its move commands lost the files instead.
By the NoFly team
move * "..\anuraag_xyz project"- Agent
- Gemini CLI
- Came from
- The agent’s own plan
- Rule
- Bulk file moves need a person
- Why
- A wildcard move of every file in the project into another folder.
What happened
Product manager Anuraag Gupta asked Gemini CLI to move the contents of a project folder into a new folder on his Windows machine. The agent ran mkdir, said the new directory was created, and issued a series of move commands it treated as successful.
When he could not find the folder, the agent’s own searches failed. It concluded that the mkdir had likely failed silently and wrote that it had lost his data. As Ars Technica reported from Gupta’s analysis, on Windows moving a file to a folder that does not exist renames it, so each move overwrote the one before.
- 01
The agent runs mkdir, which fails silently.
- 02
It reports the folder as created.
- 03
It moves each file into the missing folder.
- 04
Each move overwrites the last, and the files are lost.
Why it worked
Probable cause
The agent never checked that the destination existed before moving files, and trusted its own reading of the results.
How NoFly stops it
Protect
The gate inside Gemini CLI sees each command before it runs, and every step is kept in one record, so a loss can be traced step by step.
What to do this week
- Work in a copy or a version-controlled folder when an agent moves files.
- Ask agents to check each step’s result before the next one.
- Keep backups that an agent’s file access cannot reach.
More from the blog.
Find out what your AI is allowed to do today.
Book a call and we will map your agents, MCP servers and keys with you, or start on one laptop with the free scan.