{"record":{"id":"b6a30d0d1ab51f6b","repo":"hashicorp/vagrant","slug":"destroying-guests-with-parallel-automatically","errorCode":null,"errorMessage":"Destroying guests with `--parallel` automatically enables `--force`.\nPress ctrl-c to cancel.","messagePattern":"Destroying guests with `--parallel` automatically enables `--force`\\.\nPress ctrl-c to cancel\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"plugins/commands/destroy/command.rb","lineNumber":41,"sourceCode":"            options[:force] = f\n          end\n\n          o.on(\"--[no-]parallel\",\n               \"Enable or disable parallelism if provider supports it (automatically enables force)\") do |p|\n            options[:parallel] = p\n          end\n\n          o.on(\"-g\", \"--graceful\", \"Gracefully poweroff of VM\") do |f|\n            options[:force_halt] = false\n          end\n        end\n\n        # Parse the options\n        argv = parse_options(opts)\n        return if !argv\n\n        if options[:parallel] && !options[:force]\n          @env.ui.warn(I18n.t(\"vagrant.commands.destroy.warning\"))\n          sleep(5)\n          options[:force] = true\n        end\n\n        @logger.debug(\"'Destroy' each target VM...\")\n\n        machines = []\n        init_states = {}\n        declined = 0\n\n        @env.batch(options[:parallel]) do |batch|\n          with_target_vms(argv, reverse: true) do |vm|\n            # gather states to be checked after destroy\n            init_states[vm.name] = vm.state.id\n            machines << vm\n            batch.action(vm, :destroy, force_confirm_destroy: options[:force], force_halt: options[:force_halt])\n          end\n        end","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/commands/destroy/command.rb#L23-L59","documentation":"When `vagrant destroy` runs with --parallel but without --force, Vagrant warns that parallel destroy automatically enables force mode (per-machine confirmations are skipped), sleeps 5 seconds so you can press ctrl-c, sets options[:force] = true, then destroys every targeted machine concurrently via env.batch.","triggerScenarios":"`vagrant destroy --parallel` (no -f/--force) in any environment; the warning prints, sleep(5) runs, and then with_target_vms iterates all machines in reverse order with no further prompts.","commonSituations":"Multi-machine Vagrantfiles where the operator expected selective per-VM prompts; automation unaware that --parallel implies --force; accidental destruction of the whole environment.","solutions":["Press ctrl-c within the 5-second window if the destroy is unintended","Re-run without --parallel to get per-machine confirmation prompts","Scope the destroy to named machines: `vagrant destroy --parallel web db`","Pass --force explicitly in automation to skip both the warning and the 5-second wait"],"exampleFix":"# before\nvagrant destroy --parallel        # implies --force for ALL machines\n# after\nvagrant destroy --parallel web      # only the named machine","handlingStrategy":"validation","validationCode":"# Wrapper guard: refuse --parallel destroy unless machine names are given\nif [[ \"$*\" == *--parallel* && \"$#\" -le 1 ]]; then\n  echo \"refusing: --parallel destroy of ALL machines; name machines explicitly\" >&2\n  exit 1\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `vagrant status` before any destroy to see the blast radius","Prefer naming machines explicitly in destroy commands","In automation, pass --force yourself so behavior is visible in the script, not implied"],"tags":["vagrant","destroy","parallel","force","multi-machine"],"backgroundTag":"auto-enabled-destructive-flag","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}