hashicorp/vagrant · warning
WARNING: The second argument to `vagrant box remove`
Error message
WARNING: The second argument to `vagrant box remove`
What it means
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.
Source
Thrown at plugins/commands/box/command/remove.rb:60
options[:all_providers] = a
end
o.on("--all-architectures", "Remove all architectures within a provider a version of the box") do |a|
options[:all_architectures] = a
end
end
# Parse the options
argv = parse_options(opts)
return if !argv
if argv.empty? || argv.length > 2
raise Vagrant::Errors::CLIInvalidUsage,
help: opts.help.chomp
end
if argv.length == 2
# @deprecated
@env.ui.warn("WARNING: The second argument to `vagrant box remove`")
@env.ui.warn("is deprecated. Please use the --provider flag. This")
@env.ui.warn("feature will stop working in the next version.")
options[:provider] = argv[1]
end
@env.action_runner.run(Vagrant::Action.action_box_remove, {
box_name: argv[0],
box_architecture: options[:architecture],
box_provider: options[:provider],
box_version: options[:version],
force_confirm_box_remove: options[:force],
box_remove_all_versions: options[:all],
box_remove_all_providers: options[:all_providers],
box_remove_all_architectures: options[:all_architectures]
})
# Success, exit status 0
0View on GitHub (pinned to 35f3160f4a)
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).
Example fix
# before vagrant box remove ubuntu/jammy64 virtualbox # after vagrant box remove ubuntu/jammy64 --provider virtualbox
Defensive patterns
Strategy: validation
Validate before calling
# Reject legacy two-positional-arg invocations before running if [ "$#" -eq 2 ]; then echo "use: vagrant box remove $1 --provider $2" >&2; exit 2 fi vagrant box remove "$@"
Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- is deprecated. Please use the --provider flag. This
- feature will stop working in the next version.
- The box you requested to be removed could not be found. No b
- You requested to remove the box '%{name}'. This box has mult
- You requested to remove the box '%{name}' version '%{version
AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21).
Data as JSON: /api/errors/ea9ea5032be2ddcc.
Report an issue: GitHub.