◉CLAUDE LABJP
●2.1.334 — Claude Code 2.1.334: /model now has a search box once the list passes 25 models, matching names and model IDs●FAST — Fast mode for Claude Opus 4.8 ended on 11/30. Drop speed: "fast" and Opus 4.8 keeps working●OPUS 4.5 — claude-opus-4-5 retires on 2027/1/22, 50 days from now. The replacement is claude-opus-5-5●IME — On the Windows desktop app, pressing Enter to confirm Japanese IME input can send the message early●NEW — New: Compare tool-use requests across three routes before moving to Bedrock●MCP — More setups now share one local MCP server across Claude Code, Cursor and Antigravity●2.1.334 — Claude Code 2.1.334: /model now has a search box once the list passes 25 models, matching names and model IDs●FAST — Fast mode for Claude Opus 4.8 ended on 11/30. Drop speed: "fast" and Opus 4.8 keeps working●OPUS 4.5 — claude-opus-4-5 retires on 2027/1/22, 50 days from now. The replacement is claude-opus-5-5●IME — On the Windows desktop app, pressing Enter to confirm Japanese IME input can send the message early●NEW — New: Compare tool-use requests across three routes before moving to Bedrock●MCP — More setups now share one local MCP server across Claude Code, Cursor and Antigravity
Articles/Cowork
◈ Cowork/2026-12-02Intermediate

When a Scheduled Task Stops on 'denied by the auto mode classifier', I Move the Destructive Step Into Its Own Call

A Cowork scheduled task stopped on 'Permission for this action was denied by the Claude Code auto mode classifier'. How to tell this message apart, the order I narrowed it down in, the split-and-replace fix, and a script that checks task instructions beforehand.

Cowork74Scheduled Tasks21Auto ModeTroubleshooting33Git6

On the second afternoon of December, I was watching a scheduled task run when it stopped on its very first step — fetching a repository. The reply was a sentence I hadn't seen before:

Permission for this action was denied by the Claude Code auto mode classifier.
Reason: [Destructive or Unwanted Actions].

The task itself is ordinary indie developer work: pull my own website's repository and update it. I had only run the line my runbook told me to run, so for a moment I just stared at it.

Looking closer, though, what got stopped was the way I had written the step. This is a record of how I narrowed it down and how I rewrote the instructions.

First, figure out which message you actually got

There are at least three messages that show up in similar moments, and each has a different cause and a different fix. I nearly mistook mine for a broken permission setting.

MessageWhat it meansFirst move
denied by the ... auto mode classifier (with a Reason)The classifier read the action and judged it riskyRewrite the command
auto mode "cannot determine the safety" of an actionThe request to the classifier itself failedUsually transient; retry later
A permission prompt or a wait for approvalNot in auto mode, or auto mode has pausedCheck the mode and the block count

The official Permission modes page describes the second one as a separate message meaning a classifier request failed. Mine was the first kind, Reason included — the classifier had read the command and decided to stop it.

Narrow it down by asking which word in the call triggered it

Here is roughly what I had sent. I had bundled a line that reads a note with the lines that prepare the repository, all in a single call.

# The step that was blocked (trimmed to the essentials)
sed -n '1,60p' "$WS/_documents/notes.md"
if [ -d "$WORK/.git" ]; then
  cd "$WORK" && git remote set-url origin "$URL" \
    && git reset --hard HEAD -q && git clean -fdq \
    && git pull --rebase origin main
else
  git clone --depth 1 --branch main "$URL" "$WORK"
fi

The official "blocked by default" list includes git reset --hard, git clean -fd, git checkout -- ., and git stash drop, which the classifier presumes would discard uncommitted changes. The same page says a remote repointed during the session with git remote set-url is not trusted.

Then I noticed something. $WORK didn't exist yet, so only the else branch — the clone — would ever have run. The reset sat in a branch that could not execute.

The whole call was still blocked, and the harmless sed at the top never ran either. As far as I can tell, the classifier judges the command as written, not the branch that would actually be taken. The docs even note that under server-side review, git reset --hard can be blocked on a clean working tree.

This is the order I used to narrow it down:

  1. Check whether the message carries a Reason (if so, it's a judgment about the content)
  2. Look for verbs from the default list in the call: reset, clean, stash drop, force push, rm -rf "$VAR"
  3. Check whether the remote is repointed mid-session
  4. Check whether a delete target is still a bare variable (the docs say an unassigned variable leaves the classifier unable to tell what would be deleted)

The fix is to split and to replace

My first impulse was to send the same step again. That isn't a good idea. According to the docs, after 3 blocks in a row or 20 in total, auto mode pauses. In an unattended run, the blocked step simply doesn't happen while the rest of the work carries on without it.

What actually worked for me was this: confirm with ls alone that the folder didn't exist, then clone into a fresh location in a separate call.

# Call 1: look only
ls -ld /tmp/repos /tmp/repos/* 2>&1 | head
# Call 2: add only (no deleting, no repointing)
mkdir -p /tmp/repos
git clone --depth 1 --branch main "$URL" /tmp/repos/site-repo

That went straight through. The thinking behind it comes down to three things:

  • Split: reading, checking, and changing go into separate calls, so one word no longer takes unrelated lines down with it
  • Replace: instead of "delete the old copy and tidy it up," put a new copy somewhere fresh — clone into an empty folder rather than reset and clean
  • Name it: if you truly must delete, write the literal path instead of a variable; the docs say this clears that particular block

Never put a cleanup step and a step forward on the same call. That was the line that helped most this time.

Check the instructions before they get blocked

Once a scheduled task's runbook is written, I sometimes don't reread it for months. So I put together a small script that scans instruction files and shell scripts for steps the classifier tends to block by default.

#!/usr/bin/env python3
"""定期タスクの指示文・シェルスクリプトから、auto モードの分類器が既定で止めやすい一手を拾う。"""
import re
import sys
from pathlib import Path
 
# (名前, 正規表現, 置き換えの方向)
RULES = [
    ("git reset --hard", r"git\s+reset\s+--hard", "新しいフォルダへ clone し直す"),
    ("git clean -f", r"git\s+clean\s+-[a-z]*f", "新しいフォルダへ clone し直す"),
    ("git checkout -- .", r"git\s+checkout\s+--\s+\.", "変更を残したまま別ブランチで作業する"),
    ("git restore .", r"git\s+restore\s+\.", "変更を残したまま別ブランチで作業する"),
    ("git stash drop/clear", r"git\s+stash\s+(drop|clear)", "stash は消さずに残す"),
    ("rm -rf $変数", r"rm\s+-[a-z]*r[a-z]*f?[a-z]*\s+\"?\$\{?[A-Za-z_]", "消す先をそのまま書くか、退避フォルダへ mv する"),
    ("強制 push", r"git\s+push\b[^\n]*(\s--force\b|\s-f\b)", "通常の push と pull --rebase に戻す"),
    ("curl | sh", r"curl\b[^\n|]*\|\s*(ba)?sh\b", "落としてから中身を見て実行する"),
    ("remote の付け替え", r"git\s+remote\s+(set-url|add)\b", "clone の URL で最初から決める"),
]
 
 
def scan(path: Path):
    hits = []
    for no, line in enumerate(path.read_text(encoding="utf-8", errors="replace").splitlines(), 1):
        for name, pattern, advice in RULES:
            if re.search(pattern, line):
                hits.append((no, name, advice, line.strip()))
    return hits
 
 
def main(argv):
    if len(argv) < 2:
        print("usage: scan_blocked_steps.py FILE_OR_DIR ...")
        return 2
    files = []
    for arg in argv[1:]:
        p = Path(arg)
        files += sorted(x for x in p.rglob("*") if x.suffix in {".md", ".sh", ".txt"}) if p.is_dir() else [p]
    total = 0
    for f in files:
        for no, name, advice, line in scan(f):
            total += 1
            print(f"{f}:{no}: [{name}] -> {advice}\n    {line[:90]}")
    print(f"--- {len(files)} files / {total} hits")
    return 1 if total else 0
 
 
if __name__ == "__main__":
    sys.exit(main(sys.argv))

Running it over three files — the instructions with the blocked step, a cleanup script, and the instructions after the fix — gave me this:

prompts/cleanup.sh:2: [rm -rf $変数] -> 消す先をそのまま書くか、退避フォルダへ mv する
    rm -rf "$OLD"
prompts/cleanup.sh:3: [rm -rf $変数] -> 消す先をそのまま書くか、退避フォルダへ mv する
    rm -rf "$HOME/work/tmp_thumbs_2026-12-01"
prompts/repo_refresh.md:3: [git reset --hard] -> 新しいフォルダへ clone し直す
prompts/repo_refresh.md:3: [git clean -f] -> 新しいフォルダへ clone し直す
prompts/repo_refresh.md:3: [remote の付け替え] -> clone の URL で最初から決める
--- 3 files / 5 hits

The fixed instructions produced no hits. The script also flags variables whose value is easy to read, like "$HOME/...", and the hints are in Japanese because that's how my own runbooks are written — swap in your own wording freely.

The over-matching is deliberate. I'd rather it catch too much than miss something, and leave the final "is the target obvious here?" call to a human. I treat it as a first draft for review, not a verdict.

It exits with 1 when there are hits, so running it only on days you edit a runbook is plenty.

If it still gets blocked

If the rewrite still gets stopped, the quickest route is to see what your environment blocks by default. In Claude Code, claude auto-mode defaults prints the built-in rules as JSON.

In an interactive session, the docs say a blocked action appears in /permissions under the Recently blocked tab, where you can approve it so Claude may retry. If trusted internal repos or buckets get blocked routinely, an administrator can add them through autoMode.environment.

An unattended scheduled task, though, has nobody to approve anything. What I prefer is writing into the instructions: if a step is blocked, skip it, log it, and finish. I keep one rule at the very top of those instructions — never look for a roundabout way past the reason it was blocked.

For another day when the clone location itself was the problem, Why I Stopped Borrowing a Stale Repo and Started Cloning Fresh After a Scheduled Task Couldn't Write to Shared /tmp covers a script for choosing the working directory and a check before pushing. It also measures what re-cloning every run actually costs, which may help if you're deciding whether "replace instead of clean" fits your own setup.

The one thing I'd suggest doing next is running the script above, just once, over your own scheduled-task runbooks. In my case only one line had been blocked, but rewriting it made the whole runbook far easier to follow.

Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

If you found this article helpful, a small tip ($1.50) would mean a lot to us. Your support helps keep this site ad-free and covers server and hosting costs.

Related Articles

◈ Cowork2026-10-21
Why I Stopped Borrowing a Stale Repo and Started Cloning Fresh After a Scheduled Task Couldn't Write to Shared /tmp
A scheduled task stopped because it could not create its clone directory under /tmp. Here is how I traced it, the borrowable clone that was about 9.6 hours behind, the cost of cloning fresh every run, and a script that picks a working directory.
◈ Cowork2026-10-17
When a Scheduled Task Keeps Saying SUCCEEDED but Produces Nothing, Check Outbound Traffic in the First Minute
The run history is green, but the output file is still yesterday's. A short probe and a freshness check that tell you in the first minute whether outbound calls are being refused with a 403 on CONNECT.
◈ Cowork2026-09-24
Will Your Cowork Scheduled Task Still Run Next Saturday?
A definition that runs once and stops, two fire times packed into one task, a weekday that quietly emptied after an edit. Cowork schedules can go missing without leaving a single log line. Here is a working audit that compares what you defined with what you meant.