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/virtualbox/cap/cleanup_disks.rb:42

        protected

        # @param [Vagrant::Machine] machine
        # @param [VagrantPlugins::Kernel_V2::VagrantConfigDisk] defined_disks
        # @param [Array<Hash>] disk_meta - An array of all the previously defined disks from the last configure_disk action
        def self.handle_cleanup_disk(machine, defined_disks, disk_meta)
          raise TypeError, "Expected `Array` but received `#{disk_meta.class}`" if !disk_meta.is_a?(Array)
          storage_controllers = machine.provider.driver.read_storage_controllers

          primary = storage_controllers.get_primary_attachment
          primary_uuid = primary[:uuid]

          disk_meta.each do |d|
            dsk = defined_disks.select { |dk| dk.name == d["name"] }
            if !dsk.empty? || d["uuid"] == primary_uuid
              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)

              controller = storage_controllers.get_controller(d["controller"])
              attachment = controller.get_attachment(uuid: d["uuid"])

              if !attachment
                LOGGER.warn("Disk '#{d["name"]}' not attached to guest, but still exists.")
              else
                machine.provider.driver.remove_disk(controller.name, attachment[:port], attachment[:device])
              end

              machine.provider.driver.close_medium(d["uuid"])
            end
          end
        end

        # @param [Vagrant::Machine] machine
        # @param [VagrantPlugins::Kernel_V2::VagrantConfigDisk] defined_dvds
        # @param [Array<Hash>] dvd_meta - An array of all the previously defined dvds from the last configure_disk action

View on GitHub (pinned to 35f3160f4a)

When it happens

Trigger: Thrown at plugins/providers/virtualbox/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/f262bc52095ff29f. Report an issue: GitHub.