[BUG] Claude Code (Opus 4.7) ran bulk DELETE against my live database with no confirmation — destroyed user data

Resolved 💬 4 comments Opened Apr 28, 2026 by RonB-LandingAI Closed May 30, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

While I was building a Flask + SQLite app with Claude Code (Opus 4.7), Claude wrote a Python verification script to test some slug-generation logic. The first step of the script was:

# Clean
for a in req("GET", "/api/agents"):
    req("DELETE", f"/api/agents/{a['id']}")

It executed this against my live, in-use database — the same one I had spent the prior hour creating real records in via the app's UI. Every record was permanently deleted. Resource folders on disk were also rmtree'd as a cascade.

No preview. No "I'm about to delete N records" warning. No confirmation prompt. Claude treated "clean slate before tests" as routine prep.


### What Should Happen?



Model rule: before issuing any DELETE / DROP / TRUNCATE / rm against a database, table, or directory containing user data, require explicit confirmation in the same turn. Test scripts must not bypass it.

Default to test isolation: when Claude writes verification code that needs a clean slate, the default behavior should be a temp DB copy, not the live one. Treat the user's working DB as untouchable unless they say otherwise.

Pre-flight summary: before running any script that contains destructive ops against user data, surface what's about to be deleted (count, table) and pause. Don't just run it.

Scaffold defaults: community guidance for Anthropic-style apps (including the claude-api skill examples) should explicitly include *.db files in backups. Many scaffolds exclude them, leaving users with no recovery path even when they think they're protected.


### Error Messages/Logs

```shell

Steps to Reproduce

# Clean
for a in req("GET", "/api/agents"):
    req("DELETE", f"/api/agents/{a['id']}")

- Use Claude Code to develop any local app with a SQLite database the user populates via UI.
- Ask Claude to test a new endpoint or behavior change.
- Watch Claude write a verification script that begins with "delete all existing records to ensure clean slate."

### Claude Model

Opus

### Is this a regression?

I don't know

### Last Working Version

_No response_

### Claude Code Version

Claude 1.4758.0 (fb266c) 

### Platform

Anthropic API

### Operating System

macOS

### Terminal/Shell

Terminal.app (macOS)

### Additional Information

_No response_

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗