claude-code - 💡(How to fix) Fix Claude ran 'docker compose down -v' without user permission, destroying database volumes

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

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.

Error Message

  1. 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)

Root Cause

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.

RAW_BUFFERClick to expand / collapse

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

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

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)

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Claude ran 'docker compose down -v' without user permission, destroying database volumes