{"record":{"id":"5de55cfe89832ad4","repo":"lima-vm/lima","slug":"nested-virtualization-is-not-supported-on-t","errorCode":null,"errorMessage":"nested virtualization is not supported on %T","messagePattern":"nested virtualization is not supported on %T","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/driver/vz/vm_darwin.go","lineNumber":364,"sourceCode":"\n\t// nested virt\n\tif *inst.Config.NestedVirtualization {\n\t\tmacOSProductVersion, err := osutil.ProductVersion()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to get macOS product version: %w\", err)\n\t\t}\n\n\t\tif macOSProductVersion.LessThan(*semver.New(\"15.0.0\")) {\n\t\t\treturn errors.New(\"nested virtualization requires macOS 15 or newer\")\n\t\t}\n\n\t\tif !vz.IsNestedVirtualizationSupported() {\n\t\t\treturn errors.New(\"nested virtualization is not supported on this device\")\n\t\t}\n\n\t\tgenericPlatformConfig, ok := platformConfig.(*vz.GenericPlatformConfiguration)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"nested virtualization is not supported on %T\", platformConfig)\n\t\t}\n\n\t\tif err := genericPlatformConfig.SetNestedVirtualizationEnabled(true); err != nil {\n\t\t\treturn fmt.Errorf(\"cannot enable nested virtualization: %w\", err)\n\t\t}\n\t}\n\n\tvmConfig.SetPlatformVirtualMachineConfiguration(platformConfig)\n\treturn nil\n}\n\nfunc attachSerialPort(inst *limatype.Instance, config *vz.VirtualMachineConfiguration) error {\n\tpath := filepath.Join(inst.Dir, filenames.SerialVirtioLog)\n\tserialPortAttachment, err := vz.NewFileSerialPortAttachment(path, false)\n\tif err != nil {\n\t\treturn err\n\t}\n\tconsoleConfig, err := vz.NewVirtioConsoleDeviceSerialPortConfiguration(serialPortAttachment)","sourceCodeStart":346,"sourceCodeEnd":382,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/driver/vz/vm_darwin.go#L346-L382","documentation":"After confirming OS and hardware support, the driver type-asserts the VZ platform configuration to *vz.GenericPlatformConfiguration, the only configuration type that supports SetNestedVirtualizationEnabled. If the platformConfig built earlier is a different VZ configuration type (e.g. a macOS-specific platform config), the assertion fails and this error reports the actual Go type.","triggerScenarios":"Enabling nestedVirtualization: true while the VM was configured with a non-generic platform configuration — notably when creating a VM via createVMForMacInstaller that uses a macOS platform configuration instead of the generic Linux one.","commonSituations":"Attempting nested virtualization on a macOS guest installer VM; future/alternative VZ platform configs where nested virt is not implemented in Lima.","solutions":["Enable nested virtualization only for standard Linux guests (generic platform configuration).","Don't combine nestedVirtualization: true with the macOS-installer VM flow.","Check the %T in the message to see which platform config was built and adjust the instance config accordingly.","If you need nested VMs inside macOS guests, that's not supported — use a Linux guest."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"// ensure the workload targets a Linux guest, not the macOS installer flow\n# only standard Linux instances use the generic platform config","typeGuard":"// Go: narrow the platform config type before enabling\ngeneric, ok := platformConfig.(*vz.GenericPlatformConfiguration)\nif !ok {\n    return fmt.Errorf(\"nested virtualization is not supported on %T\", platformConfig)\n}\n_ = generic","tryCatchPattern":"// Go: match on the concrete type before SetNestedVirtualizationEnabled\nswitch pc := platformConfig.(type) {\ncase *vz.GenericPlatformConfiguration:\n    _ = pc.SetNestedVirtualizationEnabled(true)\ndefault:\n    // skip nested virt for non-generic configs\n}","preventionTips":["Only enable nested virtualization for standard Linux guests","Don't combine nestedVirtualization with macOS installer VMs","Read the %T in the error to identify the actual config type"],"tags":["vz-driver","nested-virtualization","type-mismatch"],"backgroundTag":"nested-virtualization-unsupported","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}