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

  1. User asked: "Ejecuta docker compose up webapi y revisa los errores y warnings. Resuelve todo hasta que pueda levantar webapi sin errores" (Run docker compose up webapi, check errors, fix everything until webapi starts)
  2. 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)
  3. Claude fixed the migration file correctly (adding USING cast)
  4. Without asking the user, Claude ran docker compose down -v — a destructive command that removes all volumes
  5. 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 -v flag 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:

  1. Explicitly tell the user what the command will destroy
  2. Ask for confirmation before proceeding
  3. Default to the least destructive option (e.g., docker compose down without -v)

Environment

  • Model: claude-sonnet-4-6
  • Platform: macOS (Darwin 25.5.0)
  • Claude Code CLI

View original on GitHub ↗

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