hashicorp/vagrant · error · Vagrant::Errors::BoxRemoveVersionNotFound

You requested to remove the box '%{name}' version '%{version

Error message

You requested to remove the box '%{name}' version '%{version}',
but that specific version of the box is not installed. Please
double-check and try again. The available versions for this box
are:

%{versions}

What it means

Errors::BoxRemoveVersionNotFound is raised when an explicit --box-version was given for removal but that version is not installed for the named box. The error lists the versions that actually are installed.

Source

Thrown at lib/vagrant/action/builtin/box_remove.rb:51

          # If there's no box info, then the box doesn't exist here
          if box_info.empty?
            raise Errors::BoxRemoveNotFound, name: box_name
          end

          # Filtering only matters if not removing all versions
          if !box_remove_all_versions
            # If no version was provided, and not removing all versions,
            # only allow one version to proceed
            if !box_version && box_info.size > 1
              raise Errors::BoxRemoveMultiVersion,
                name: box_name,
                versions: box_info.keys.sort.map { |k| " * #{k}" }.join("\n")
            end

            # If a version was provided, make sure it exists
            if box_version
              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,

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. Copy the exact version string from the error's 'available versions' list.
  2. Run 'vagrant box list' to see canonical name/version formatting.
  3. Drop --box-version (with --all if multiple) when the exact version does not matter.

Example fix

# before
vagrant box remove ubuntu/jammy64 --box-version 202303   # real string is 202303.0.0

# after
vagrant box remove ubuntu/jammy64 --box-version 202303.0.0
Defensive patterns

Strategy: validation

Validate before calling

installed = env.box_collection.all
  .select { |n, *, | n == box_name }.map { |_, v, *, | v }
exit 0 unless installed.include?(requested_version)

Type guard

def version_installed?(collection, name, version)
  collection.all.any? { |n, v, *, | n == name && v == version }
end

Try / catch

begin
  env.cli("box", "remove", name, "--box-version", ver)
rescue Vagrant::Errors::BoxRemoveVersionNotFound => e
  # e.extra_data[:versions] lists what is really installed
  warn "installed versions: #{e.extra_data[:versions]}"
end

Prevention

When it happens

Trigger: box_version is truthy and !box_info.keys.include?(box_version) after the collection scan; the raise carries name, the requested version, and the sorted installed versions as ' * version' lines.

Common situations: The version string is misformatted (202303 vs 202303.0.0 - Cloud boxes use full triplets); the version was already removed by a previous cleanup run; docs/README pins a version the user never installed.

Related errors


AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21). Data as JSON: /api/errors/c472b9f247580103. Report an issue: GitHub.