lima-vm/lima · error

failed to get macOS product version: %w

Error message

failed to get macOS product version: %w

What it means

attachPlatformConfig only enables nested virtualization when inst.Config.NestedVirtualization is true, and it first fetches the host macOS version to gate the feature. If osutil.ProductVersion() fails during this check, VM creation fails with this wrapped error.

Source

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

	platformConfig, err := vz.NewGenericPlatformConfiguration(vz.WithGenericMachineIdentifier(machineIdentifier))
	if err != nil {
		return nil, err
	}
	return platformConfig, nil
}

func attachPlatformConfig(inst *limatype.Instance, vmConfig *vz.VirtualMachineConfiguration) error {
	platformConfig, err := newPlatformConfiguration(inst)
	if err != nil {
		return err
	}

	// nested virt
	if *inst.Config.NestedVirtualization {
		macOSProductVersion, err := osutil.ProductVersion()
		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)
		}

View on GitHub (pinned to dd909d0973)

Solutions

  1. Verify `sw_vers -productVersion` works on the host.
  2. Fix or avoid the environment that blocks OS version detection (run limactl directly, not inside a sandbox).
  3. Upgrade macOS to a supported release.
  4. If nested virtualization is not needed, set nestedVirtualization: false to skip this code path entirely.

Example fix

// before (lima.yaml)
nestedVirtualization: true
// after (lima.yaml)
nestedVirtualization: false
Defensive patterns

Strategy: validation

Validate before calling

// verify version probe works before enabling nested virt
sw_vers -productVersion && echo OK || echo "probe broken; nested virt check will fail"

Try / catch

// Go: guard the config gate
if *inst.Config.NestedVirtualization {
    if _, err := osutil.ProductVersion(); err != nil {
        return fmt.Errorf("nested virt requires a readable macOS version: %w", err)
    }
}

Prevention

When it happens

Trigger: Starting a VZ instance with nestedVirtualization: true in lima.yaml on a host where the macOS version probe fails.

Common situations: Sandboxed or broken environments where sw_vers/SystemVersion.plist is unreadable; unusual macOS builds failing semver parse — only affects templates enabling nested virtualization.

Related errors


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