{"record":{"id":"ea9ea5032be2ddcc","repo":"hashicorp/vagrant","slug":"warning-the-second-argument-to-vagrant-box-remov","errorCode":null,"errorMessage":"WARNING: The second argument to `vagrant box remove`","messagePattern":"WARNING: The second argument to `vagrant box remove`","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"plugins/commands/box/command/remove.rb","lineNumber":60,"sourceCode":"              options[:all_providers] = a\n            end\n\n            o.on(\"--all-architectures\", \"Remove all architectures within a provider a version of the box\") do |a|\n              options[:all_architectures] = a\n            end\n          end\n\n          # Parse the options\n          argv = parse_options(opts)\n          return if !argv\n          if argv.empty? || argv.length > 2\n            raise Vagrant::Errors::CLIInvalidUsage,\n              help: opts.help.chomp\n          end\n\n          if argv.length == 2\n            # @deprecated\n            @env.ui.warn(\"WARNING: The second argument to `vagrant box remove`\")\n            @env.ui.warn(\"is deprecated. Please use the --provider flag. This\")\n            @env.ui.warn(\"feature will stop working in the next version.\")\n            options[:provider] = argv[1]\n          end\n\n          @env.action_runner.run(Vagrant::Action.action_box_remove, {\n            box_name:     argv[0],\n            box_architecture: options[:architecture],\n            box_provider: options[:provider],\n            box_version:  options[:version],\n            force_confirm_box_remove: options[:force],\n            box_remove_all_versions: options[:all],\n            box_remove_all_providers: options[:all_providers],\n            box_remove_all_architectures: options[:all_architectures]\n          })\n\n          # Success, exit status 0\n          0","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/commands/box/command/remove.rb#L42-L78","documentation":"First of three hardcoded warning lines printed by `vagrant box remove` (plugins/commands/box/command/remove.rb) when the command is invoked with two positional arguments (argv.length == 2), i.e. the legacy `vagrant box remove <name> <provider>` form. The second argument is treated as the provider via options[:provider] = argv[1], and the deprecation notice warns that this will stop working in the next version.","triggerScenarios":"Running `vagrant box remove mybox virtualbox` (two positional args) instead of `vagrant box remove mybox --provider virtualbox`. Any script or shell history still using the old two-argument spelling triggers all three warning lines.","commonSituations":"Old tutorials, provisioning scripts, and Makefiles written for pre-flag Vagrant versions; muscle memory from other tools where the provider is positional; copy-pasted commands from outdated docs.","solutions":["Replace the positional provider with the flag: `vagrant box remove <name> --provider <provider>`.","Audit scripts/docs for the two-argument pattern (`box remove \\S+ \\S+`) and update them before upgrading Vagrant, since the feature is scheduled for removal.","Combine with other flags as needed: --version, --box-version kept as documented (--provider is the only replacement needed here)."],"exampleFix":"# before\nvagrant box remove ubuntu/jammy64 virtualbox\n\n# after\nvagrant box remove ubuntu/jammy64 --provider virtualbox","handlingStrategy":"validation","validationCode":"# Reject legacy two-positional-arg invocations before running\nif [ \"$#\" -eq 2 ]; then\n  echo \"use: vagrant box remove $1 --provider $2\" >&2; exit 2\nfi\nvagrant box remove \"$@\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always use `--provider` when removing boxes for a specific provider.","Grep repos and docs for `vagrant box remove \\S+ \\S+` and fix matches.","Add a wrapper/alias in shared tooling that rewrites the old form to the flag form."],"tags":["vagrant","deprecation","box-remove","cli-arguments"],"backgroundTag":"deprecated-positional-argument","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}