← Claude Code Hub
Nov 22, 2026 · 6 min read ✦ Tip #282

Claude Code rm denied in bypass permissions: how to delete those files

Claude Code in bypass permissions, from the Desktop app or the VS Code panel, denies some `rm` commands on the spot: your working folder, a `./*`, a variable that might be empty. Why it happens, and how to get the delete through without removing the brake.

Claude Code in bypass permissions from Desktop or VS Code: rm -rf ./* is denied on the spot and the files stay; rm -rf dist coverage .cache, with literal paths inside the project, runs without a prompt

TL;DR When Claude says it left a removal for you, read the command it names. Ask for literal paths inside the project (rm -rf dist coverage, not rm -rf ./*) and guarded variables ("${OUT:?}"/*): that passes the check and runs. Anything that really has to delete your working folder or your home, run yourself.

Claude Code checks every rm and rmdir before it runs, looking for critical paths: the root, top-level folders (/usr, /tmp, /data), your home, your working folder and its parents, and any target it can't resolve before running, such as a variable that might be empty. No allow rule approves what it finds. In the terminal, bypass permissions asks you, with a two-minute countdown. In the Desktop app and the VS Code chat panel there is no prompt: since v2.1.309 the command is denied on the spot, so an unattended session doesn't sit there waiting for you.

What Claude gets instead of the output

The command doesn't run and your files stay where they were. Claude receives this text, verbatim from the v2.1.330 binary:

Permission for this command was denied by a built-in Claude Code safety check, not by the user. The check stops removals that can delete far more than intended: a system, home or workspace directory, or a target it cannot resolve, such as a shell variable that, if unset or empty, turns this into `rm -rf /` or `rm -rf /*`. Only a person may approve such a removal, and no person did (the permission prompt timed out, or none was shown). The command was NOT run; do not claim it succeeded. Do not work around the check by splitting, scripting, or re-issuing the removal through another tool or shell: the check exists because a removal like this can destroy the user's data, and getting past it would not make it safe. If the text below suggests a safe rewrite, run that instead; it goes through the same check. Otherwise finish the rest of the task without this removal, tell the user what you wanted to delete and why, and leave the removal to them. What was flagged: Dangerous rm operation detected: '/Users/ana/web/*' This command would remove a workspace directory (the working directory, an additional working directory, or one of their parent directories). This requires explicit approval and cannot be auto-allowed by permission rules.

The last sentence depends on the case; this one is for an rm -rf ./* in /Users/ana/web, an example path. Three things follow from that text, and you'll see all of them:

  • Claude doesn't try another trick: splitting the removal, moving it into a script or sending it through another tool is ruled out.
  • If the reason carries a safe rewrite, Claude tries it. For an unguarded variable the reason literally says rewrite it as "${OUT:?}"/*, and that version passes.
  • With no rewrite, it finishes the rest of the task and, at the end, tells you what it wanted to delete and why. That message is your cue: the removal is still pending.

Which commands trigger it

Since v2.1.330 more commands aimed at the root, your home, a top-level folder or your working folder fall into the check, so if this never happened to you before, it can now. The cases you'll hit most in a project, with the version that gets through:

What Claude tries Why it's denied What passes the check
rm -rf ./* or rm -rf . It's your working folder rm -rf dist coverage .cache
rm -rf .. It's the working folder's parent Run it yourself
rm -rf "$OUT"/* With $OUT empty, it deletes from / rm -rf "${OUT:?}"/*
D=$(pwd); rm -rf "$D" $D names your working folder The literal path; ${D:?} doesn't help
rm -rf "$(pwd)" The target can't be seen before it runs Run pwd first, delete what it prints
rm -rf logs/*/* It can't tell which folders it reaches Name each folder

Anything outside that list runs without a prompt in bypass: rm -rf node_modules, rm -rf dist/* or a single file inside the project don't stop.

How to get it deleted

1. Tell Claude how to delete, before it tries

One line in the project's CLAUDE.md heads off most denials:

To delete, use literal paths inside the project (rm -rf dist coverage), never ./* or the project folder. If a target comes from a variable, write it as "${VAR:?}".

2. If it was already denied, ask for the rewrite

When Claude says it left a removal pending, reply with the version from the table: "delete dist and coverage by name" or "use ${OUT:?}". The new command goes through the same check and, if it's no longer critical, runs.

3. What really is critical, run yourself

If you do want to empty the project folder or delete something in your home, copy the command Claude gives you, read all of it and run it in your terminal. That's what the docs suggest: the denial exists so that a person makes that call.

4. In VS Code, get the prompt back

If you'd rather approve it on the spot, add this to VS Code's user settings.json and start a new conversation:

{
  "claudeCode.environmentVariables": [
    { "name": "CLAUDE_CODE_DISABLE_DANGEROUS_RM_TIMEOUT", "value": "1" }
  ]
}

With the variable set, the chat panel asks you instead of denying. The docs offer no such switch for the Desktop app: there, only a PermissionRequest hook that approves the removal lifts the denial, and that hook decides on every permission request its matcher catches, not just removals.

The variable that turns it all off

CLAUDE_CODE_EVEN_MORE_DANGEROUSLY_SKIP_PERMISSIONS=1 lets these removals run with no prompt, rm -rf ~ included. It also doesn't work in Desktop or the VS Code panel: only in a session you start yourself from a terminal. If you ever need it, that work belongs in a container, not on your machine. What bypass permissions skips and what it doesn't is in what --dangerously-skip-permissions really does, and what this same brake does under claude -p is in why your script exits green without doing anything.

The check only looks at rm and rmdir: a find -delete or a script that deletes on its own doesn't go through it. If what you want is a Claude that can't touch anything outside the project, that's the sandbox's job, not this brake's.

Where the session runs, in bypass permissions An rm on a critical path
Terminal Asks you, with a two-minute countdown; press any key to stop it
VS Code chat panel Denied on the spot, unless a PermissionRequest hook approves it
VS Code panel with CLAUDE_CODE_DISABLE_DANGEROUS_RM_TIMEOUT=1 Asks you
Desktop app Denied on the spot, unless a PermissionRequest hook approves it

Official docs: Critical paths · Time limits and denials in auto and bypassPermissions modes

Requirements

  • The immediate denial in Desktop and VS Code arrives in v2.1.309, and the wider list of targets in v2.1.330. The text Claude receives comes from the v2.1.330 binary; the cases in the table come from the docs and that same binary, not from a Desktop session.

Found this useful? See more of wmedia.es in your Google results.

Add wmedia.es as a preferred source on Google
FREE GUIDE

You don't need Opus every time.

Model and effort are two settings, not one. 8 pages with the settings that actually move your bill, a three-question diagnostic for when something fails, and the price ladder.

  • 1. What "better" means capability, time and money
  • 2. Model who you send
  • 3. Effort how much rope you give
  • 4. Diagnostic three questions when something fails
  • 5. The bill where it comes from
Are you a professional Web developer?

You'll receive the guide by email · Unsubscribe anytime

of 8
#

Wmedia · 8 pages
FREE GUIDE · 8 pages · 2 dials

You don't need Opus every time.

Model and effort are two settings, not one. 8 pages with the settings that actually move your bill, a three-question diagnostic for when something fails, and the price ladder.

Are you a professional Web developer? · Unsubscribe anytime

Using Opus for everything? See when you don't need it.