{"record":{"id":"a49d80290474488b","repo":"hashicorp/vagrant","slug":"disk-name-could-not-be-found-and-could-not-b","errorCode":null,"errorMessage":"Disk '%{name}' could not be found, and could not be properly removed. Please remove this disk manually if it still exists","messagePattern":"Disk '%(.+?)' could not be found, and could not be properly removed\\. Please remove this disk manually if it still exists","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/providers/hyperv/cap/cleanup_disks.rb","lineNumber":46,"sourceCode":"        # @param [Hash] disk_meta - A hash of all the previously defined disks from the last configure_disk action\n        def self.handle_cleanup_disk(machine, defined_disks, disk_meta)\n          all_disks = machine.provider.driver.list_hdds\n\n          disk_meta.each do |d|\n            # look at Path instead of Name or UUID\n            disk_name  = File.basename(d[\"Path\"], '.*')\n            dsk = defined_disks.select { |dk| dk.name == disk_name }\n\n            if !dsk.empty? || d[\"primary\"] == true\n              next\n            else\n              LOGGER.warn(\"Found disk not in Vagrantfile config: '#{d[\"Name\"]}'. Removing disk from guest #{machine.name}\")\n\n              machine.ui.warn(I18n.t(\"vagrant.cap.cleanup_disks.disk_cleanup\", name: d[\"Name\"]), prefix: true)\n\n              disk_actual = all_disks.select { |a| File.realdirpath(a[\"Path\"]) == File.realdirpath(d[\"Path\"]) }.first\n              if !disk_actual\n                machine.ui.warn(I18n.t(\"vagrant.cap.cleanup_disks.disk_not_found\", name: d[\"Name\"]), prefix: true)\n              else\n                machine.provider.driver.remove_disk(disk_actual[\"ControllerType\"], disk_actual[\"ControllerNumber\"], disk_actual[\"ControllerLocation\"], disk_actual[\"Path\"])\n              end\n            end\n          end\n        end\n\n        def self.handle_cleanup_dvd(machine, defined_disks, disk_meta)\n          # Get a list of all attached DVD drives\n          attached = machine.provider.driver.read_scsi_controllers.map do |controller|\n            controller[\"Drives\"].map do |drive|\n              drive if drive[\"DvdMediaType\"].to_i == 1\n            end.compact\n          end.flatten.compact\n\n          # Generate list of dvd disks that previously\n          # existed but are no longer defined\n          orphan_attachments = disk_meta.find_all do |mdisk|","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/providers/hyperv/cap/cleanup_disks.rb#L28-L64","documentation":"Error \"Disk '%{name}' could not be found, and could not be properly removed. Please remove this disk manually if it still exists\" thrown in hashicorp/vagrant.","triggerScenarios":"Thrown at plugins/providers/hyperv/cap/cleanup_disks.rb:46 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}