lima-vm/lima · error
cannot enable nested virtualization: %w
Error message
cannot enable nested virtualization: %w
What it means
When everything else passes, the driver calls genericPlatformConfig.SetNestedVirtualizationEnabled(true). If the Virtualization framework itself rejects the call, the driver wraps that error and returns it from attachPlatformConfig, failing VM creation.
Source
Thrown at pkg/driver/vz/vm_darwin.go:368
if err != nil {
return fmt.Errorf("failed to get macOS product version: %w", err)
}
if macOSProductVersion.LessThan(*semver.New("15.0.0")) {
return errors.New("nested virtualization requires macOS 15 or newer")
}
if !vz.IsNestedVirtualizationSupported() {
return errors.New("nested virtualization is not supported on this device")
}
genericPlatformConfig, ok := platformConfig.(*vz.GenericPlatformConfiguration)
if !ok {
return fmt.Errorf("nested virtualization is not supported on %T", platformConfig)
}
if err := genericPlatformConfig.SetNestedVirtualizationEnabled(true); err != nil {
return fmt.Errorf("cannot enable nested virtualization: %w", err)
}
}
vmConfig.SetPlatformVirtualMachineConfiguration(platformConfig)
return nil
}
func attachSerialPort(inst *limatype.Instance, config *vz.VirtualMachineConfiguration) error {
path := filepath.Join(inst.Dir, filenames.SerialVirtioLog)
serialPortAttachment, err := vz.NewFileSerialPortAttachment(path, false)
if err != nil {
return err
}
consoleConfig, err := vz.NewVirtioConsoleDeviceSerialPortConfiguration(serialPortAttachment)
config.SetSerialPortsVirtualMachineConfiguration([]*vz.VirtioConsoleDeviceSerialPortConfiguration{
consoleConfig,
})
return errView on GitHub (pinned to dd909d0973)
Solutions
- Read the wrapped %w error for the framework's underlying reason.
- Upgrade macOS to the latest release to get framework fixes.
- Don't run Lima inside another VM when using nested virtualization — run on bare-metal Apple Silicon.
- Disable nestedVirtualization in lima.yaml if the framework cannot enable it.
Defensive patterns
Strategy: try-catch
Validate before calling
// preflight: bare-metal Apple Silicon, macOS 15+ sw_vers -productVersion # >= 15.0.0 sysctl -n machdep.cpu.brand_string # Apple Silicon
Try / catch
// Go: surface the wrapped framework error
if err := genericPlatformConfig.SetNestedVirtualizationEnabled(true); err != nil {
log.Errorf("VZ rejected nested virtualization: %v", err)
return err
} Prevention
- Run on bare-metal Apple Silicon, not inside another VM
- Keep macOS updated for VZ framework fixes
- Read the wrapped error for the framework's exact reason
- Disable nestedVirtualization if the framework cannot enable it
When it happens
Trigger: Enabling nestedVirtualization: true on macOS 15+ with reported hardware support, but VZ's SetNestedVirtualizationEnabled still fails at VM configuration time (e.g. race between capability check and set, or framework-level validation error).
Common situations: macOS betas or VM hosts (running Lima inside another VM) where the capability check passes but enabling fails; corrupted VZ state; running under a hypervisor that masks the feature.
Related errors
- nested virtualization requires macOS 15 or newer
- failed to get macOS product version: %w
- failed to create a new rosetta directory share caching optio
- failed to get macOS product version: %w
- nested virtualization requires macOS 15 or newer
AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01).
Data as JSON: /api/errors/76bfeae42505f2be.
Report an issue: GitHub.