{"record":{"id":"7b51a9e2d6fc1418","repo":"hashicorp/vagrant","slug":"you-requested-to-remove-the-box-name-this-bo","errorCode":null,"errorMessage":"You requested to remove the box '%{name}'. This box has multiple\nversions. You must explicitly specify which version you want to\nremove with the `--box-version` flag or specify the `--all` flag\nto remove all versions. The available versions for this box are:\n\n%{versions}","messagePattern":"You requested to remove the box '%(.+?)'\\. This box has multiple\nversions\\. You must explicitly specify which version you want to\nremove with the `--box-version` flag or specify the `--all` flag\nto remove all versions\\. The available versions for this box are:\n\n%(.+?)","errorType":"exception","errorClass":"Vagrant::Errors::BoxRemoveMultiVersion","httpStatus":null,"severity":"error","filePath":"lib/vagrant/action/builtin/box_remove.rb","lineNumber":43,"sourceCode":"          box_info = Util::HashWithIndifferentAccess.new\n          env[:box_collection].all.each do |name, version, provider, architecture|\n            next if name != box_name\n            box_info[version] ||= Util::HashWithIndifferentAccess.new\n            box_info[version][provider] ||= []\n            box_info[version][provider] << architecture\n          end\n\n          # If there's no box info, then the box doesn't exist here\n          if box_info.empty?\n            raise Errors::BoxRemoveNotFound, name: box_name\n          end\n\n          # Filtering only matters if not removing all versions\n          if !box_remove_all_versions\n            # If no version was provided, and not removing all versions,\n            # only allow one version to proceed\n            if !box_version && box_info.size > 1\n              raise Errors::BoxRemoveMultiVersion,\n                name: box_name,\n                versions: box_info.keys.sort.map { |k| \" * #{k}\" }.join(\"\\n\")\n            end\n\n            # If a version was provided, make sure it exists\n            if box_version\n              if !box_info.keys.include?(box_version)\n                raise Errors::BoxRemoveVersionNotFound,\n                  name: box_name,\n                  version: box_version,\n                  versions: box_info.keys.sort.map { |k| \" * #{k}\" }.join(\"\\n\")\n              else\n                box_info.delete_if { |k, _| k != box_version }\n              end\n            end\n\n            # Only a single version remains\n            box_version = box_info.keys.first","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/lib/vagrant/action/builtin/box_remove.rb#L25-L61","documentation":"Errors::BoxRemoveMultiVersion is raised when the named box has multiple versions installed, the user passed no --box-version, and --all was not requested. Vagrant refuses to guess which version to delete and prints every installed version.","triggerScenarios":"box_remove_all_versions is falsy, box_version is nil, and box_info.size > 1 after the collection scan for box_name; the raise carries name and versions formatted as ' * version' lines.","commonSituations":"Long-lived workstations accumulating several versions of the same box; 'vagrant box remove ubuntu/jammy64' after box updates left old versions behind; cleanup scripts that assume a single version.","solutions":["Pick a version from the error's list: vagrant box remove NAME --box-version X.Y.Z.","Remove every version at once: vagrant box remove NAME --all.","Run 'vagrant box list' first to see the layout when scripting."],"exampleFix":"# before\nvagrant box remove ubuntu/jammy64   # 3 versions installed -> BoxRemoveMultiVersion\n\n# after (one version)\nvagrant box remove ubuntu/jammy64 --box-version 202303.0.0\n\n# after (all versions)\nvagrant box remove ubuntu/jammy64 --all","handlingStrategy":"validation","validationCode":"versions = env.box_collection.all\n  .select { |n, *, | n == box_name }.map { |_, v, *, | v }.uniq\nif versions.size > 1\n  # choose explicitly instead of letting vagrant prompt/raise\n  remove(box_name, box_version: versions.sort.last)\nend","typeGuard":"def single_version_box?(collection, name)\n  collection.all.count { |n, *, | n == name && true } <= 1 ||\n    collection.all.select { |n, *, | n == name }.map { |_, v, *, | v }.uniq.size == 1\nend","tryCatchPattern":"begin\n  env.cli(\"box\", \"remove\", name)\nrescue Vagrant::Errors::BoxRemoveMultiVersion => e\n  # e.extra_data[:versions] is a pre-formatted ' * x.y.z' list\n  chosen = e.extra_data[:versions].lines.first.strip.sub(\"* \", \"\")\n  env.cli(\"box\", \"remove\", name, \"--box-version\", chosen)\nend","preventionTips":["Pass --box-version (or --all) whenever scripting removals against shared workstations.","Prune old versions periodically with 'vagrant box prune' so single-version assumptions hold."],"tags":["vagrant","box-remove","versioning","disambiguation"],"backgroundTag":"ambiguous-resource-disambiguation","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}