{"record":{"id":"e292629e7a7841dd","repo":"hashicorp/vagrant","slug":"disk-name-no-longer-exists-in-vagrant-config","errorCode":null,"errorMessage":"Disk '%{name}' no longer exists in Vagrant config. Removing and closing medium from guest...","messagePattern":"Disk '%(.+?)' no longer exists in Vagrant config\\. Removing and closing medium from guest\\.\\.\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/providers/hyperv/cap/cleanup_disks.rb","lineNumber":42,"sourceCode":"        protected\n\n        # @param [Vagrant::Machine] machine\n        # @param [VagrantPlugins::Kernel_V2::VagrantConfigDisk] defined_disks\n        # @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","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/providers/hyperv/cap/cleanup_disks.rb#L24-L60","documentation":"Error \"Disk '%{name}' no longer exists in Vagrant config. Removing and closing medium from guest...\" thrown in hashicorp/vagrant.","triggerScenarios":"Thrown at plugins/providers/hyperv/cap/cleanup_disks.rb:42 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"}