hashicorp/vagrant · error · Vagrant::Errors.VirtualBoxDisksControllerNotFound

Vagrant expected to find a storage controller called '%{name

Error message

Vagrant expected to find a storage controller called '%{name}',
but there is no controller with this name attached to the current VM.
If you have changed or removed any storage controllers, please restore
them to their previous configuration.

What it means

The disk-management feature looks up storage controllers by name via StorageControllerArray#get_controller, which raises VirtualBoxDisksControllerNotFound when no attached controller matches the requested name. It is called from configure_disks/cleanup_disks whenever Vagrant needs the controller a disk is (or was) attached to. The mismatch is between the controller name recorded in the disk metadata/Vagrantfile and what `VBoxManage showvminfo` actually reports for the VM.

Source

Thrown at plugins/providers/virtualbox/model/storage_controller_array.rb:20

# SPDX-License-Identifier: BUSL-1.1

require_relative "../cap/validate_disk_ext"

module VagrantPlugins
  module ProviderVirtualBox
    module Model
      # A collection of storage controllers. Includes finder methods to look
      # up a storage controller by given attributes.
      class StorageControllerArray < Array
        # Returns a storage controller with the given name. Raises an
        # exception if a matching controller can't be found.
        #
        # @param [String] name - The name of the storage controller
        # @return [VagrantPlugins::ProviderVirtualBox::Model::StorageController]
        def get_controller(name)
          controller = detect { |c| c.name == name }
          if !controller
            raise Vagrant::Errors::VirtualBoxDisksControllerNotFound, name: name
          end
          controller
        end

        # Find the controller containing the primary disk (i.e. the boot
        # disk). This is used to determine which controller virtual disks
        # should be attached to.
        #
        # Raises an exception if no supported controllers are found.
        #
        # @return [VagrantPlugins::ProviderVirtualBox::Model::StorageController]
        def get_primary_controller
          ordered = find_all(&:supported?).sort_by(&:boot_priority)
          controller = ordered.detect { |c| c.attachments.any? { |a| hdd?(a) } }

          if !controller
            raise Vagrant::Errors::VirtualBoxDisksNoSupportedControllers,
              supported_types: supported_types.join(", ")

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. List the VM's real controllers: `VBoxManage showvminfo <uuid> --machinereadable | grep storagecontrollername`
  2. Restore the missing controller in the VirtualBox GUI with the exact name Vagrant expects, or update the Vagrantfile disk config to use an existing controller name
  3. If the disk config is stale, remove the `config.vm.disk` blocks, run `vagrant up` so cleanup succeeds, then re-add them
  4. Worst case: `vagrant destroy && vagrant up` to rebuild the VM with a consistent controller set

Example fix

# Vagrantfile — before (controller name not attached to this VM)
config.vm.disk :disk, size: "10GB", controller: "SCSI Controller"
# after — match a controller shown by `VBoxManage showvminfo <uuid>`, or omit the option
config.vm.disk :disk, size: "10GB", controller: "SATA Controller"
Defensive patterns

Strategy: validation

Validate before calling

names = `VBoxManage showvminfo #{uuid} --machinereadable`.scan(/^storagecontrollername\d+="(.+)"/).flatten
raise 'controller missing - fix disk config' unless names.include?(expected_controller_name)

Type guard

def controller_attached?(uuid, name)
  `VBoxManage showvminfo #{uuid} --machinereadable`.scan(/^storagecontrollername\d+="(.+)"/).flatten.include?(name)
end

Prevention

When it happens

Trigger: A `config.vm.disk` entry (or disk state stored under .vagrant) references controller_name X, but `showvminfo` shows no storage controller named X — after controllers were renamed/removed in the VirtualBox GUI, a box was rebuilt with a different controller layout, or the disk config names a controller that never existed.

Common situations: User edited storage controllers in the VirtualBox GUI after the VM was created; switching a box to one that uses 'IDE Controller' vs 'SATA Controller' naming; leftover disk metadata from experiments with the (evolving) disk feature; non-English VirtualBox installs reporting localized controller names.

Related errors


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