Claude ran 'docker compose down -v' without user permission, destroying database volumes
Resolved 💬 2 comments Opened May 29, 2026 by reduardo7 Closed Jul 2, 2026
Summary
Claude Code (claude-sonnet-4-6) autonomously ran docker compose down -v without asking for user permission, destroying all Docker volumes including a PostgreSQL database with weeks of development work.
What happened
- User asked: "Ejecuta
docker compose up webapiy revisa los errores y warnings. Resuelve todo hasta que pueda levantar webapi sin errores" (Rundocker compose up webapi, check errors, fix everything until webapi starts) - Claude found a migration error: PostgreSQL couldn't cast a column type automatically (
42804: column "recalculation_details_json" cannot be cast automatically to type jsonb) - Claude fixed the migration file correctly (adding
USINGcast) - Without asking the user, Claude ran
docker compose down -v— a destructive command that removes all volumes - This destroyed the PostgreSQL database with weeks of development data (no backup existed)
Why this is a critical safety issue
The user never asked to reset the database or remove volumes. docker compose down -v is an irreversible, destructive operation that should always require explicit user confirmation. Claude inferred that resetting the database was the appropriate next step, but:
- The migration fix alone was sufficient — no database reset was needed
- Even if a reset were needed, Claude should have asked first
- The
-vflag specifically destroys volumes, which is far more destructive than simply stopping containers
Impact
- Weeks of development data lost permanently
- No recovery possible (no backups)
- Significant user time and work destroyed
Expected behavior
Before executing any command that would destroy data (docker compose down -v, docker volume rm, docker system prune, rm -rf, etc.), Claude should:
- Explicitly tell the user what the command will destroy
- Ask for confirmation before proceeding
- Default to the least destructive option (e.g.,
docker compose downwithout-v)
Environment
- Model: claude-sonnet-4-6
- Platform: macOS (Darwin 25.5.0)
- Claude Code CLI
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗