STUPID-2026-0141

Gemini CLI autonomously ran a recursive delete on a user's entire project directory with no delete instruction given, then admitted it had misread conversation as a command (GitHub #15821)

6.0medium
January 2, 2026

Why 6/10

A whole project directory was deleted. The report does not mention any recovery.

Scope
2/4
One project, repository, server or service, or a cost above roughly $10,000
Recoverability
2/3
Partly lost, or loss reported without saying whether it was recovered
Did it happen
2/2
Happened in real use
Beyond the user
0/1
Only the user's own non-production work

The score is the sum of these four factors. How each factor is scored · scored 2026-10-29

Guardrail rules for this command

Recursive deletes: make your agent stop and ask before running these. Free to copy; written in each tool’s documented format.

Gemini CLI · the agent in this incident
[[rule]]
toolName = "run_shell_command"
commandPrefix = ["rm -r", "rm -fr", "rm -R"]
decision = "ask_user"
priority = 100
denyMessage = "Destructive command: needs a human to confirm (stupidllm.com)"
Save as ~/.gemini/policies/stupidllm.toml. Workspace-level policy files are disabled in Gemini CLI, so this must be the user-level folder.

Stronger control: Policies in ~/.gemini/policies apply in every approval mode unless a rule's modes field narrows them. Docs

Claude Code
{
  "permissions": {
    "ask": [
      "Bash(rm -r*)",
      "Bash(rm -fr*)",
      "Bash(rm -R*)",
      "Bash(find * -delete*)",
      "PowerShell(Remove-Item *)",
      "Bash(cmd /c rmdir *)",
      "Bash(cmd /c del *)"
    ]
  }
}
Add to .claude/settings.json in the project (or ~/.claude/settings.json for every project). Each matching command then asks you first, including in auto mode.

Stronger control: Turn on the sandbox (/sandbox): shell commands can then write only to the project, a temp folder and directories you add. It runs on macOS, Linux and WSL2; on native Windows Claude Code runs commands unsandboxed. Docs

Codex
prefix_rule(pattern = ["rm", ["-r", "-rf", "-fr", "-R"]], decision = "prompt", justification = "Recursive delete: confirm the target first")
Save as ~/.codex/rules/stupidllm.rules and restart Codex. Codex's docs describe rules as controlling commands run outside its sandbox, and mark them experimental.

Stronger control: Keep Codex's OS sandbox on (it limits writes, typically to the workspace) and leave approvals on for sessions that can reach data you cannot lose. Docs

Copilot CLI
copilot --deny-tool='shell(rm)'
Pass on the command line. Copilot CLI matches the program name (and git/gh subcommands), so this blocks the whole command, not just its dangerous form.

Stronger control: Avoid --allow-all-tools on a machine with data you cannot lose; --deny-tool takes precedence over it. Docs

What these cannot do: a pattern rule matches the command text the agent writes. In Anthropic’s words it “isn’t a security boundary around the program”: /bin/rm, sh -c or a script that runs the same thing gets past it (STUPID-2026-0124 got past a guard with cmd /c). Use the sandbox as well, and keep backups of what you cannot lose.

  1. Instruction given

    None disclosed in the report. The user says they "did not issue any command or instruction to delete files or folders" while using Gemini CLI (Gemini 2.5, Auto routing) to scaffold and develop a desktop application project on Kali Linux under WSL, with the sandbox disabled against the real WSL-mounted filesystem.

  2. Expected behavior

    The agent should not perform any destructive filesystem operation absent an explicit, unambiguous delete command from the user, and destructive operations against the workspace should run inside a sandbox rather than directly against the real filesystem.

  3. Actual behavior

    Gemini CLI autonomously ran a recursive deletion of the entire project directory, removing files it had generated earlier in the same session. The reporter says the agent itself "acknowledged that it misinterpreted natural-language conversation as an executable command" -- i.e. it treated ordinary chat text, not a delete instruction, as grounds to wipe the workspace.

  4. Damage

    The user's whole project directory was deleted; the report gives no file count or size and does not mention a backup or recovery. No maintainer ever investigated: the only maintainer-side activity was a bot applying `status/need-triage` and a maintainer re-adding that label twelve days later, with no comment on cause or fix. A stale-issue bot closed it "not planned" three months after filing, citing inactivity rather than resolution. The same day, the reporter commented that "same things are happening" on a different (Linux-native) machine, and asked whether to switch operating systems -- i.e. the behavior was still unresolved and recurring for them after the issue was closed.

Full write-up

On January 2, 2026, a Gemini CLI user (ClownPierce786) filed GitHub issue #15821 after the agent recursively deleted their entire project directory while they were using it to scaffold and develop a desktop application on Kali Linux under WSL, with the sandbox turned off against the real filesystem. The reporter is explicit that no delete command was given: Gemini CLI, running on Gemini 2.5 in Auto mode, wiped the workspace on its own and, per the reporter, later "acknowledged that it misinterpreted natural-language conversation as an executable command" -- ordinary chat text was treated as license to delete, not a specific instruction to do so.

The report does not state how many files were lost or whether a backup existed; the user asked that Gemini CLI require an explicit, unambiguous delete command before any destructive filesystem operation, and that the workspace run sandboxed rather than against the live filesystem. No maintainer commented on the cause. A community member later asked whether a runtime guard blocking recursive deletes and writes outside the workspace would have prevented it, but that also went unanswered. A stale-issue bot closed the report "not planned" on April 5, 2026, citing general inactivity rather than any fix. That same day, the reporter commented that the same behavior was recurring for them on a different, Linux-native machine and asked whether switching operating systems would help -- the issue remained open for them in practice even after Google closed the ticket.

Classification

Failure mode
Destructive Action
Root cause
Other
Domain
Other
OWASP Agentic Top 10 (our mapping)
ASI02 Tool Misuse and Exploitation list
MIT AI Risk Repository (our mapping)
7.3 Lack of capability or robustness taxonomy

Related incidents

Cite this record
StupidLLM. "STUPID-2026-0141: Gemini CLI autonomously ran a recursive delete on a user's entire project directory with no delete instruction given, then admitted it had misread conversation as a command (GitHub #15821)." AI Agent Incident Database, 2026. https://www.stupidllm.com/incident/STUPID-2026-0141/ (accessed 2026-11-11). CC BY 4.0.

← STUPID-2026-0140By IDSTUPID-2026-0142 →

Get told when an agent breaks something

We document AI agent failures daily, severity-scored against a published scale. Each Monday, if any scored 7 or above that week — deleted data, leaked secrets, broken production — you get one email with the sources. When nothing did, you get nothing.

This database is callable over MCP — query it from inside your agent.