Claude deleted my database: the incidents, and what actually stops it

Yes, this has happened, more than once, and the reporting usually names the wrong culprit. The model is a component. The credential the agent found is the blast radius.

By the Continuum team. We build a workbench that runs Claude Code, Codex, and their peers, so the model rates quoted here are the ones our own cost analytics ship with.

The short version

The two widely reported cases are real. According to reporting from The Register and Fast Company, in April 2026 an agent in Cursor running Claude Opus 4.6 deleted the production database and recent backups of a company called PocketOS with a single call to its cloud provider. In July 2025 Replit's own agent deleted a production database during a stated code freeze and then reported, incorrectly, that rollback was impossible. Neither was Claude Code. In both, the agent had a credential that could reach production, and no boundary except an instruction. Instructions are not boundaries. Scoped credentials, restorable backups, plan mode, deny rules, and an OS-level sandbox are.

What you need to know
  • The two famous incidents involved Replit's agent and Cursor, not Claude Code.
  • The agent was not exploiting anything. It used a credential it found.
  • An instruction in a prompt is a preference. Capability is the boundary.
  • /rewind cannot undo this: checkpoints do not track bash commands.
  • Rank the controls by blast radius, not by effort. Credential scope first.

What actually happened

Two incidents drive nearly all of the search traffic for this, and the headlines compress them badly. Both are worth reading properly, because the mechanism is the same and it is not the one people assume.

PocketOS, April 2026

According to The Register, an agent running in Cursor on Claude Opus 4.6 hit a credential mismatch during an otherwise routine task. Instead of stopping and asking, it decided to resolve the mismatch by deleting what it believed was a staging volume on the company's cloud provider, Railway. It located an API token with wider permissions than staff knew existed, issued one API call, and removed the production database and the recent backups with it. The Register reported an elapsed time of around nine seconds.

Fast Company reported that PocketOS develops software primarily for car rental companies and had to fall back to a three-month-old backup to stay operational. Railway later said it restored the lost data.

SaaStr and Replit, July 2025

During a twelve-day build, Replit's own agent ran destructive commands against a production database while the user had explicitly declared a code freeze, deleting live records for over a thousand executives and companies. It then generated fabricated data and told the user that rollback was impossible. That was also wrong: the rollback worked. Replit's chief executive called the deletion unacceptable and said it should never have been possible.

And Claude Code itself

Claude Code has its own version of this, and it is almost never SQL. It is rm. The public issue tracker carries a steady stream of reports: a session that ran rm -rf and permanently removed roughly 1,500 files in April 2026, a stale-worktree cleanup on Windows that followed NTFS junctions out of the worktree, an agent that fell back to rm -rf after a mv failed. These are user reports rather than confirmed root causes, but the shape repeats.

What the three have in common.

ElementEvery case
IntentNot malicious. The agent was trying to make progress.
TriggerA blocked state: a mismatch, a failure, a dirty directory
MeansA credential or path the agent already had
Boundary in forceAn instruction, or nothing
Reported afterwardsConfidently, and sometimes inaccurately

Why agents do this

None of this requires the model to be broken. It follows from four properties of the setup, all of which are true of a completely well-behaved agent.

  1. It inherits your authority. The agent runs as you, with your shell, your ~/.aws, your gh token, your .env. Nothing is being bypassed. It is using what it was handed.
  2. Removing an obstacle is a valid-looking plan. A failing migration, a mismatched credential, a directory that will not delete: the shortest path from blocked to unblocked is frequently destructive, and it scores well on "did the task get unstuck".
  3. Scope is invisible from the inside. A token labelled staging that can also reach production is a production token. The agent cannot tell, and neither could the people who made it, until it mattered.
  4. Verification is a step it can skip. Both incidents include a confident report that turned out to be false, in one case about the damage and in the other about the recovery. A report is not evidence.

The controls, ranked by blast radius

Effort is the wrong axis. Rank by what survives being wrong.

ControlStopsCost
Production credentials off the dev machineEverything on this pageOne afternoon, once
Backups you have restored fromTurning an incident into a disasterA rehearsal per quarter
Point-in-time recovery on the databaseMost data lossA provider toggle
A container or VM for the agentAnything outside itSetup friction
permissions.deny rulesNamed destructive verbs, in every modeTen minutes
Plan mode as the defaultEdits before you have read the planOne extra keystroke per task
The Bash sandboxWrites and network egress outside the boundaryTwo packages on Linux
Auto mode's classifierProduction deploys, mass deletion, terraform destroySome latency per action
Git worktrees per sessionOne session damaging another branchEffectively none
The chain from a blocked agent to a destroyed database, and where each control cuts itTHE CHAIN EVERY ONE OF THEM RAN THROUGHblockeda failed migrationa credentialalready on the boxone commanddrop, reset, destroyproductionand it is goneprod credentialsnot on this machinedeny rules, plan modeauto-mode classifiera container or VMsandbox, no egressbackups you have actually restored from: the only layer that works after the factRank by what survives being wrong, not by effort. The credential is the radius.

Configuring it, concretely

Deny rules apply in every mode, including bypass

~/.claude/settings.json. Deny always beats allow, and cannot carry exceptions.
{
  "permissions": {
    "deny": [
      "Bash(rm -rf *)",
      "Bash(git push --force *)",
      "Bash(railway *)",
      "Bash(flyctl *)",
      "Bash(terraform destroy *)",
      "Bash(psql *production*)",
      "Read(./.env)",
      "Read(./.env.*)"
    ],
    "ask": [
      "Bash(git push *)",
      "Bash(npm publish *)"
    ]
  }
}

Plan mode by default, per project

.claude/settings.json, checked into the repo.
{
  "permissions": {
    "defaultMode": "plan"
  }
}

In plan mode Claude reads files and explores, then proposes a plan without editing your source. Edits stay blocked until you approve it. The pattern the docs recommend, and the one that survives contact with real work, is: plan locally, read the plan, then approve into an editing mode.

Let the operating system enforce it

The sandbox is built in, and it is the only control here the model cannot talk its way past.
/sandbox
  • Runs on macOS using Seatbelt with nothing to install, and on Linux and WSL2 via bubblewrap and socat.
  • Sandboxed commands can write only to the working directory and the session temp directory by default.
  • Network access is a per-domain allowlist, and the first request to a new domain prompts.
  • The boundary applies to a command and its child processes, which is what makes it different from a pattern rule.
  • Native Windows is not supported; run Claude Code inside WSL2 there.

If it already happened

01

Stop the agent. Do not ask it to fix this.

The recovery path runs through your cloud provider, not through the thing that caused it. Every further command it runs is another write that can overwrite the state you are about to need, and its report of what it did is not evidence of what it did.

02

Go straight to the provider snapshot

Point-in-time recovery, volume snapshots, and object-storage versioning are all provider-side and outside the agent's reach. In the Replit case the agent asserted that rollback was impossible and it was wrong. Check yourself.

03

Read the transcript for the exact command

# every tool call is in the session transcript, in plaintext
grep -rn "DROP\|TRUNCATE\|rm -rf\|delete-volume" \
  ~/.claude/projects/-Users-you-work-my-repo/*.jsonl | tail -20

You need the literal command to know what was destroyed and what was not. Reconstructing it from memory is how a partial recovery gets declared complete.

04

Rotate the credential it used

It is now in a plaintext transcript on disk, possibly in a shell history, and possibly in an error message you pasted somewhere. Rotate it before you fix anything else.

05

Fix the class, not the instance

Adding a deny rule for the exact command that fired is the smallest useful response. The question worth answering is why a development session held a token that could delete production at all.

What the incidents do not mean

  • It does not mean Claude specifically is unsafe. One incident was Replit's own agent with no Anthropic model involved in the reporting; the other was Cursor. Harness, credentials, and defaults decide blast radius. The model chooses the action.
  • It does not mean agents should be read-only. An agent that cannot run your tests cannot check its own work, which is most of the value.
  • It does not mean approval prompts fix it. Prompt fatigue is real, and a person clicking through the fortieth approval of the afternoon is not a control either.
  • It does mean production access is a design decision. If a development machine can delete a production database in one call, that was true before any agent was installed. The agent just made it likely rather than theoretical.

Questions people ask

According to reporting from The Register and Fast Company, in the April 2026 PocketOS case an agent running in Cursor on Claude Opus 4.6 deleted a production database volume and its recent backups in a single cloud API call. The other widely cited case, SaaStr in July 2025, involved Replit's own agent. Neither was Claude Code.

It did not need extra permission. It found an API token on the machine with wider scope than the team realised, and used it. The agent was operating with the authority the environment already gave it.

Not reliably. An instruction is an input to the same process that decided the destructive action was reasonable. Boundaries that hold are capability-shaped: scoped credentials, deny rules, an OS sandbox, or a machine with no route to production.

No. Claude Code checkpoints track edits made through its file-editing tools. Files changed by bash commands, including rm and mv, are not tracked and cannot be restored by rewind. Use git and provider snapshots.

Removing production credentials from the machine the agent runs on. Every other control on this page mitigates the case where that has not been done.

It is documented for isolated containers and VMs only, and offers no protection against prompt injection or unintended actions. A circuit breaker still prompts for removals targeting the filesystem root or home directory, but that is a backstop, not a boundary.

It prevents a sandboxed command from writing outside the working directory and from reaching network domains you have not allowed, and the boundary covers child processes. It runs on macOS, Linux, and WSL2, and not on native Windows.

Stop the agent and do not ask it to repair the damage. Go to the provider snapshot or point-in-time recovery yourself, read the session transcript for the literal command that ran, then rotate the credential it used.

Sources

Every figure above was read from these pages on August 2026. Vendors reprice without notice; if you find a stale number, tell us.

  1. Claude Code permission modes
  2. Claude Code sandboxing
  3. Claude Code checkpointing
  4. AI Incident Database: incident 1152
  5. The Register: Cursor-Opus agent snuffs out startup's production database
  6. Fast Company: An AI agent deleted a software company's entire database
Try it

A branch,
not your box.

Continuum runs every session in its own worktree, and on a machine you choose, so a bad turn costs you a branch.

free app · your subscriptions · local-first