lima-vm/lima · error

failed to create new virtio block device config for extra…

Error message

failed to create new virtio block device config for extra disk %#q: %w

What it means

Creating the virtio-block device configuration wrapping the disk attachment via vz.NewVirtioBlockDeviceConfiguration failed; Lima wraps the framework error. This is the last VM-configuration step for the extra disk, so the attachment object was created but the device config could not be built.

Solutions

  1. Retry after updating macOS and Lima to the latest versions
  2. Reduce the number of attached disks/devices in the VM configuration
  3. Report with the wrapped underlying error if it persists on a supported macOS version
Defensive patterns

Strategy: retry

Try / catch

if err := startInstance(cfg); err != nil {
    if strings.Contains(err.Error(), "virtio block device config") {
        // retry once after updating macOS/Lima; report the wrapped cause if persistent
    }
}

Prevention

When it happens

Trigger: vz.NewVirtioBlockDeviceConfiguration(extraDiskPathAttachment) returns an error immediately after a successful attachment creation — essentially only framework-internal failures or invalid attachment state.

Common situations: macOS Virtualization framework version quirks; resource/configuration limits in the VM config reached; rare framework bugs on beta macOS versions.

Related errors


AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01). Data as JSON: /api/errors/f74777476b9b216a. Report an issue: GitHub.

Appendix: source

Thrown at pkg/driver/vz/vm_darwin.go:608

		logrus.Infof("Mounting disk %#q on %#q", diskName, disk.MountPoint)
		if err = disk.LockForInstance(inst.Dir); err != nil {
			return fmt.Errorf("failed to attach disk %#q: %w", diskName, err)
		}
		extraDiskPath := filepath.Join(disk.Dir, filenames.DataDisk)
		// ConvertToRaw is a NOP if no conversion is needed
		logrus.Debugf("Converting extra disk %#q to a raw disk (if it is not a raw)", extraDiskPath)

		if err = diskUtil.Convert(ctx, raw.Type, extraDiskPath, extraDiskPath, nil, true); err != nil {
			return fmt.Errorf("failed to convert extra disk %#q to a raw disk: %w", extraDiskPath, err)
		}
		extraDiskPathAttachment, err := vz.NewDiskImageStorageDeviceAttachmentWithCacheAndSync(extraDiskPath, false, diskImageCachingMode, vz.DiskImageSynchronizationModeFsync)
		if err != nil {
			return fmt.Errorf("failed to create disk attachment for extra disk %#q: %w", extraDiskPath, err)
		}
		extraDisk, err := vz.NewVirtioBlockDeviceConfiguration(extraDiskPathAttachment)
		if err != nil {
			return fmt.Errorf("failed to create new virtio block device config for extra disk %#q: %w", extraDiskPath, err)
		}
		configurations = append(configurations, extraDisk)
	}

	if err := validateDiskFormat(ciDataPath); err != nil {
		return err
	}
	ciDataAttachment, err := vz.NewDiskImageStorageDeviceAttachment(ciDataPath, true)
	if err != nil {
		return err
	}
	ciData, err := vz.NewVirtioBlockDeviceConfiguration(ciDataAttachment)
	if err != nil {
		return err
	}
	configurations = append(configurations, ciData)

	vmConfig.SetStorageDevicesVirtualMachineConfiguration(configurations)

View on GitHub (pinned to dd909d0973)