hashicorp/vagrant · error

Disk '%{name}' no longer exists in Vagrant config. Removing

Error message

Disk '%{name}' no longer exists in Vagrant config. Removing and closing medium from guest...

What it means

Error "Disk '%{name}' no longer exists in Vagrant config. Removing and closing medium from guest..." thrown in hashicorp/vagrant.

Source

Thrown at plugins/providers/hyperv/cap/cleanup_disks.rb:42

        protected

        # @param [Vagrant::Machine] machine
        # @param [VagrantPlugins::Kernel_V2::VagrantConfigDisk] defined_disks
        # @param [Hash] disk_meta - A hash of all the previously defined disks from the last configure_disk action
        def self.handle_cleanup_disk(machine, defined_disks, disk_meta)
          all_disks = machine.provider.driver.list_hdds

          disk_meta.each do |d|
            # look at Path instead of Name or UUID
            disk_name  = File.basename(d["Path"], '.*')
            dsk = defined_disks.select { |dk| dk.name == disk_name }

            if !dsk.empty? || d["primary"] == true
              next
            else
              LOGGER.warn("Found disk not in Vagrantfile config: '#{d["Name"]}'. Removing disk from guest #{machine.name}")

              machine.ui.warn(I18n.t("vagrant.cap.cleanup_disks.disk_cleanup", name: d["Name"]), prefix: true)

              disk_actual = all_disks.select { |a| File.realdirpath(a["Path"]) == File.realdirpath(d["Path"]) }.first
              if !disk_actual
                machine.ui.warn(I18n.t("vagrant.cap.cleanup_disks.disk_not_found", name: d["Name"]), prefix: true)
              else
                machine.provider.driver.remove_disk(disk_actual["ControllerType"], disk_actual["ControllerNumber"], disk_actual["ControllerLocation"], disk_actual["Path"])
              end
            end
          end
        end

        def self.handle_cleanup_dvd(machine, defined_disks, disk_meta)
          # Get a list of all attached DVD drives
          attached = machine.provider.driver.read_scsi_controllers.map do |controller|
            controller["Drives"].map do |drive|
              drive if drive["DvdMediaType"].to_i == 1
            end.compact
          end.flatten.compact

View on GitHub (pinned to 35f3160f4a)

When it happens

Trigger: Thrown at plugins/providers/hyperv/cap/cleanup_disks.rb:42 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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