{"record":{"id":"f0d30c569902fdd0","repo":"hashicorp/vagrant","slug":"vagrant-was-unable-to-detect-a-disk-controller-wit","errorCode":null,"errorMessage":"Vagrant was unable to detect a disk controller with any of the\nfollowing supported types:\n\n%{supported_types}\n\nPlease add one of the supported controller types in order to use the\ndisk configuration feature.","messagePattern":"Vagrant was unable to detect a disk controller with any of the\nfollowing supported types:\n\n%(.+?)\n\nPlease add one of the supported controller types in order to use the\ndisk configuration feature\\.","errorType":"exception","errorClass":"Vagrant::Errors.VirtualBoxDisksNoSupportedControllers","httpStatus":null,"severity":"error","filePath":"plugins/providers/virtualbox/model/storage_controller_array.rb","lineNumber":37,"sourceCode":"          if !controller\n            raise Vagrant::Errors::VirtualBoxDisksControllerNotFound, name: name\n          end\n          controller\n        end\n\n        # Find the controller containing the primary disk (i.e. the boot\n        # disk). This is used to determine which controller virtual disks\n        # should be attached to.\n        #\n        # Raises an exception if no supported controllers are found.\n        #\n        # @return [VagrantPlugins::ProviderVirtualBox::Model::StorageController]\n        def get_primary_controller\n          ordered = find_all(&:supported?).sort_by(&:boot_priority)\n          controller = ordered.detect { |c| c.attachments.any? { |a| hdd?(a) } }\n\n          if !controller\n            raise Vagrant::Errors::VirtualBoxDisksNoSupportedControllers,\n              supported_types: supported_types.join(\", \")\n          end\n\n          controller\n        end\n\n        # Find the attachment representing the primary disk (i.e. the boot\n        # disk). We can't rely on the order of #list_hdds, as they will not\n        # always come in port order, but primary is always Port 0 Device 0.\n        #\n        # @return [Hash] attachment - Primary disk attachment information\n        def get_primary_attachment\n          attachment = nil\n\n          controller = get_primary_controller\n          attachment = controller.get_attachment(port: \"0\", device: \"0\")\n          if !attachment\n            raise Vagrant::Errors::VirtualBoxDisksPrimaryNotFound","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/providers/virtualbox/model/storage_controller_array.rb#L19-L55","documentation":"When managing disks, Vagrant picks the primary (boot) controller by filtering controllers to supported types, sorting by boot priority, and taking the first one that has a hard-disk attachment. If no supported controller carries an HDD, VirtualBoxDisksNoSupportedControllers is raised listing the supported types. This guards the primary-disk detection used by configure_disks (e.g. resizing the primary disk) and only triggers when the disk feature is exercised.","triggerScenarios":"get_primary_controller during `vagrant up` with `config.vm.disk` present: `find_all(&:supported?).sort_by(&:boot_priority)` yields controllers, but none of them has an attachment where hdd?(a) is true — or there are no supported controllers at all.","commonSituations":"Box whose boot disk sits on an unsupported controller type; VM imported with disks detached; custom storage topology created in the VirtualBox GUI (all disks on USB/NVMe-style controllers outside the supported set); disk config applied to a VM template that has no hard disk yet.","solutions":["Check the VM storage layout: `VBoxManage showvminfo <uuid>` — confirm the boot disk is attached to a controller of a supported type (e.g. SATA/IDE/SCSI per the error's list)","Reattach/move the hard disk to a supported controller in the VirtualBox GUI","Use a standard box (default bento/ubuntu etc.) known to work with the disk feature","Remove the `config.vm.disk` blocks if you do not need disk management on this VM"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"info = `VBoxManage showvminfo #{uuid} --machinereadable`\nsupported = %w[IDE SATA SCSI VirtIO SCSI LsiLogic SAS] # per the error's supported_types list\nhas_hdd = info.match?(/^\"#{uuid}\".*|^\\S+\\.vdi$/m) && info.lines.any? { |l| l.include?('.vdi') || l.include?('.vhd') }\nwarn 'primary disk not on a supported controller' unless has_hdd","typeGuard":"def primary_disk_on_supported_controller?(uuid)\n  info = `VBoxManage showvminfo #{uuid} --machinereadable`\n  controller_types = info.scan(/^storagecontrollertype\\d+=\"(.+)\"/).flatten\n  disks = info.scan(/^\"([^\"]+\\.(?:vdi|vhd|vmdk))\"=/).flatten\n  !disks.empty? && controller_types.any? { |t| t =~ /IDE|SATA|SCSI|SAS/i }\nend","tryCatchPattern":null,"preventionTips":["Use stock boxes with standard SATA/IDE layouts when relying on config.vm.disk","Keep the boot disk attached to a mainstream controller type","Test disk configs on a scratch VM before applying them to shared environments"],"tags":["virtualbox","storage-controller","primary-disk","disk","disk-management"],"backgroundTag":"unsupported-storage-controller","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}