Claude Code for Non-Developers
Automating Repetitive Tasks

When Automation Goes Wrong

Silent overwrites, permission fatigue, scope creep, and the automation trap: how to recognize and recover from the most common automation mistakes

The mistakes that don't announce themselves

When a command fails, your terminal shows an error. That's annoying, but it's not dangerous. The dangerous problems are the ones that look like they worked. Claude Code completes the task, reports success, and everything seems fine — until you open a file two days later and something is wrong.

In Module 3, you saw how data analysis can produce wrong numbers that look right. Automation has its own version. A bulk rename finishes, but 30% of the files got the wrong names. A file move completes, but it quietly replaced an existing file at the destination. A text replacement ran across all your files, including ones you didn't mean to touch.

This page covers four traps that catch people most often, and what to do when you land in one.

Trap 1: silent overwrites

You saw in the bulk file operations page that file moves and renames can overwrite existing files without warning. This deserves a deeper look, because it's the most common way people lose work during automation.

Here's how it happens. You ask Claude Code to organize 200 files into subfolders. Two files happen to have the same name — say, report.pdf from two different projects. Claude Code moves the first one into the target folder. Then it moves the second one to the same folder. The second file silently replaces the first. No warning. No confirmation. No error message. The first report.pdf is gone.

The same thing happens with copy operations. If you copy a file to a location where a file with that name already exists, the original at the destination is overwritten.

Deletions are even more permanent. When Claude Code removes a file using a terminal command, it doesn't go to your Trash or Recycle Bin. It's gone for good.

How to protect yourself:

  • Always work on a copy of the folder — this is the golden rule from earlier in this module, and it's your best defense against every problem on this page
  • Ask Claude Code to check for name conflicts first — before any bulk move or rename, tell it: "Before moving any files, check if any files would have the same name in the destination folder and tell me about the conflicts"
  • Ask for a dry run — "Show me what you would rename each file to, but don't actually rename anything yet"

If an overwrite already happened and you're in the same Claude Code session, try the rewind feature (press Escape twice). It can restore files that Claude Code changed through its own editing tools — but it can't undo changes made through terminal commands like mv, cp, and rm. If Claude Code used a terminal command to move or delete a file, that change isn't in the checkpoint history.

This is why working on a copy matters so much. Your original files are your real undo button.

Trap 2: permission fatigue

Claude Code asks your permission before it changes a file or runs a command. That's a safety feature. But during a bulk operation — renaming 200 files, processing 50 documents — those permission prompts pile up fast.

After the twentieth prompt, something happens. You stop reading the details. You start approving on autopilot. Yes, yes, yes, yes.

You've probably done this with cookie banners. A system asks for your attention too often, so you stop giving it real attention. Researchers call it "alert fatigue," and it hits hard during automation.

The risk: you approve an action that does something you didn't intend. Maybe Claude Code asks to delete a file that isn't part of the task. Maybe it asks to change a file outside your project folder. You approve without reading because you've already approved fifty similar-looking prompts.

How to handle it:

  • Use session-level permissions deliberately — when Claude Code asks to rename a file, you can choose "Always allow for this session" so it won't ask again for the same type of action. This is actually safer than clicking through hundreds of individual prompts, because you make one deliberate decision instead of hundreds of automatic ones
  • Use Plan mode for high-stakes operations — press Shift+Tab twice before starting. Claude Code shows you the full plan without touching any files. Review it carefully, then approve the whole thing at once
  • Take breaks in long operations — if you notice yourself approving without reading, stop. Review the last few actions Claude Code took. Make sure they look right before continuing

Heads up: Permission fatigue is especially dangerous when combined with silent overwrites. If you're approving file moves on autopilot and one of those moves overwrites an existing file, you won't notice until long after it's happened. Session-level permissions for a specific action type (like "allow file renames") are safer than clicking through prompts you've stopped reading.

Trap 3: scope creep

You ask Claude Code to rename all the files in your reports folder. It renames the files in reports, and also the files in reports/archive, reports/drafts, and reports/templates. You didn't ask it to touch those subfolders. But Claude Code interpreted "all the files in your reports folder" as including everything nested inside it.

This is scope creep: Claude Code does more than you intended. It's not wrong, exactly — "all the files in your reports folder" is genuinely ambiguous. But the result is changes to files you didn't want changed.

Common patterns:

  • Subfolder overreach — you point Claude Code at a folder, and it processes subfolders you forgot existed
  • File type overreach — you ask it to rename all documents, and it includes config files, hidden files, or system files
  • Content overreach — you ask it to find and replace a phrase in "all the reports," and it changes files that happen to contain the phrase but aren't actually reports

How to prevent it:

Be specific about the boundaries of the task:

Rename the PDF files in the reports folder. Only files directly in that folder — don't go into any subfolders. Don't touch any non-PDF files.

If you're uncertain what Claude Code will find, ask it to list the files first:

Show me all the files you would process. Don't change anything yet — just list them so I can review.

And after the operation, check the scope of what changed:

Which files did you just change? List them all.

Trap 4: the automation trap

This one isn't Claude Code's fault. It's about you spending more time automating a task than the task itself would have taken.

It starts innocently. You have a weekly report that takes 20 minutes. You decide to automate it with Claude Code. The first version works, but the formatting isn't quite right. You iterate. Now the formatting is right, but it doesn't handle edge cases. You iterate again. You're 45 minutes in, perfecting automation for a task that takes 20 minutes per week.

There's a comic that captures this perfectly. In xkcd #1319 ("Automation"), a character decides to automate a routine task. Two graphs show the punchline: in theory, you spend a bit of time writing the automation and then save time forever. In reality, the automation project itself becomes the time sink — you spend more and more time on it, and the task never actually gets easier.

The warning signs:

  • You've been refining the automation for longer than it would take to do the task manually three or four times
  • You're solving edge cases that happen once a year
  • The automation has become a project in itself, with its own to-do list
  • You've started saying "just one more tweak" for the third time

The practical rule:

If the setup is taking more than 15–20 minutes for a task you do weekly, stop and ask yourself: is the manual version actually that bad?

Automation pays off when the task happens often and the setup goes smoothly. If you're fighting the tool to get the output right, do this one by hand and automate a different task instead.

Recovering from mistakes

When something goes wrong, your options depend on what happened and how it happened.

If you're in the same session and Claude Code made the changes through its own tools, press Escape twice to open the rewind menu. You can restore files, conversation, or both to any earlier checkpoint. These checkpoints persist even after you close and reopen Claude Code.

If the changes came through terminal commands (mv, cp, rm), rewind can't help. This is where your backup copy saves you. Copy the originals back from your backup folder.

Not sure what changed? Ask Claude Code:

What files did you just change, move, or delete? List every file you touched in this session.

That gives you a starting point for checking what needs to be fixed.

If the automation produced wrong results but didn't destroy anything, start a fresh session. Rewrite your instructions with the specific problem in mind. A fresh session with better instructions almost always works better than a long session where you keep patching problems.

What's next

Next, you'll pull together everything from this module into an automation toolkit: quick reference prompts, a safety checklist for batch operations, and guidance on when to automate versus when to do it by hand.

On this page