hashicorp/vagrant · error · Vagrant::Errors::BoxRemoveMultiProvider
You requested to remove the box '%{name}' version '%{version
Error message
You requested to remove the box '%{name}' version '%{version}'. This
box has multiple providers. You must explicitly select a single provider to
remove with `--provider` or specify the `--all-providers` flag to remove
all providers.
Available providers: %{providers} What it means
Errors::BoxRemoveMultiProvider is raised when, after version filtering, the target version of the box exists under multiple providers, no --provider was given, and --all-providers was not requested. Vagrant will not guess which provider's files to delete.
Source
Thrown at lib/vagrant/action/builtin/box_remove.rb:68
if !box_info.keys.include?(box_version)
raise Errors::BoxRemoveVersionNotFound,
name: box_name,
version: box_version,
versions: box_info.keys.sort.map { |k| " * #{k}" }.join("\n")
else
box_info.delete_if { |k, _| k != box_version }
end
end
# Only a single version remains
box_version = box_info.keys.first
# Further filtering only matters if not removing all providers
if !box_remove_all_providers
# If no provider was given, check if there are more
# than a single provider for the version
if !box_provider && box_info.values.first.size > 1
raise Errors::BoxRemoveMultiProvider,
name: box_name,
version: box_version,
providers: box_info.values.first.keys.map(&:to_s).sort.join(", ")
end
# If a provider was given, check the version has it
if box_provider
if !box_info.values.first.key?(box_provider)
raise Errors::BoxRemoveProviderNotFound,
name: box_name,
version: box_version,
provider: box_provider.to_s,
providers: box_info.values.first.keys.map(&:to_s).sort.join(", ")
else
box_info.values.first.delete_if { |k, _| k.to_s != box_provider.to_s }
end
end
View on GitHub (pinned to 35f3160f4a)
Solutions
- Choose a provider from the error's list: vagrant box remove NAME --provider PROVIDER [--box-version V].
- Remove every provider for the version: vagrant box remove NAME --all-providers.
- Use 'vagrant box list' to see provider columns before scripting removal.
Example fix
# before vagrant box remove ubuntu/jammy64 --box-version 202303.0.0 # has virtualbox + vmware # after (one provider) vagrant box remove ubuntu/jammy64 --box-version 202303.0.0 --provider virtualbox # after (all providers) vagrant box remove ubuntu/jammy64 --box-version 202303.0.0 --all-providers
Defensive patterns
Strategy: validation
Validate before calling
providers = env.box_collection.all
.select { |n, v, *, | n == box_name && v == box_version }
.map { |*, p, | p }.uniq
if providers.size > 1
remove(box_name, box_version: box_version, provider: providers.first)
end Type guard
def single_provider_version?(collection, name, version)
collection.all
.select { |n, v, *, | n == name && v == version }
.map { |*, p, | p }.uniq.size == 1
end Try / catch
begin
env.cli("box", "remove", name, "--box-version", ver)
rescue Vagrant::Errors::BoxRemoveMultiProvider => e
# e.extra_data[:providers] lists the choices, comma-separated
env.cli("box", "remove", name, "--box-version", ver, "--provider", e.extra_data[:providers].split(", ").first)
end Prevention
- Include --provider in scripted removals whenever a box may exist under multiple hypervisors.
- Review 'vagrant box list' provider columns before writing cleanup automation.
When it happens
Trigger: box_remove_all_providers is falsy, box_provider is nil, and box_info.values.first.size > 1 (more than one provider key for the remaining single version); the raise carries name, version, and the sorted provider names joined with ', '.
Common situations: A box added for both virtualbox and vmware_workstation on one machine; switching hypervisors left dual entries; cleanup scripts assuming a single provider per box.
Related errors
- You requested to remove the box '%{name}'. This box has mult
- The box you requested to be removed could not be found. No b
- You requested to remove the box '%{name}' version '%{version
- You requested to remove the box '%{name}' version '%{version
- You requested to remove the box '%{name}' version '%{version
AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21).
Data as JSON: /api/errors/d3eef75326f1648d.
Report an issue: GitHub.