{"record":{"id":"16bb089755c2d734","repo":"lima-vm/lima","slug":"unsupported-disk-format-for-macos-guest-s","errorCode":null,"errorMessage":"unsupported disk format for macOS guest: %s","messagePattern":"unsupported disk format for macOS guest: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/driver/vz/vz_driver_darwin.go","lineNumber":422,"sourceCode":"\n\tdiskSize, err := units.RAMInBytes(*l.Instance.Config.Disk)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid disk size %#q: %w\", *l.Instance.Config.Disk, err)\n\t}\n\n\tswitch l.diskImageFormat {\n\tcase asif.Type:\n\t\tif err := asifutil.NewASIF(disk, diskSize); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase raw.Type:\n\t\tlogrus.Debugf(\"Using %s disk image for macOS guest\", l.diskImageFormat)\n\t\tdiskUtil := &nativeimgutil.NativeImageUtil{}\n\t\tif err := diskUtil.CreateDisk(ctx, disk, diskSize); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create %s disk %#q: %w\", l.diskImageFormat, disk, err)\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported disk format for macOS guest: %s\", l.diskImageFormat)\n\t}\n\n\tif err = ensureIPSW(l.Instance.Dir); err != nil {\n\t\treturn err\n\t}\n\tipsw := filepath.Join(l.Instance.Dir, filenames.ImageIPSW)\n\n\tvm, err := createVMForMacInstaller(ctx, l.Instance)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlogrus.Info(\"Running macOS installer (takes a few minutes)\")\n\t// FIXME: do we need to run the installer for every new instance,\n\t// or can we safely reuse the installed disk image?\n\tif err := installMacOS(ctx, vm, ipsw); err != nil {\n\t\treturn fmt.Errorf(\"failed to install macOS: %w\", err)\n\t}","sourceCodeStart":404,"sourceCodeEnd":440,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/driver/vz/vz_driver_darwin.go#L404-L440","documentation":"The macOS-guest disk creation path only handles the 'asif' and 'raw' formats; if `l.diskImageFormat` holds anything else at disk creation time, the driver returns `unsupported disk format for macOS guest: <format>`. This is a defensive default case since validateConfig normally rejects other formats earlier.","triggerScenarios":"`CreateDisk` -> `createDiskMacOSGuest` for a DARWIN guest when the resolved `diskImageFormat` is neither `raw.Type` nor `asif.Type` (e.g. validation was skipped, or the format was set via a code path bypassing validation).","commonSituations":"Programmatic driver use that constructs an instance without running validateConfig; stale cached config changed between validate and create; future/unknown format strings.","solutions":["Run `limactl start`/`validate` so the config is checked and corrected first","Set `vmOpts.vz.diskImageFormat` to 'raw' or 'asif' in the instance's lima.yaml","Recreate the instance with a supported format"],"exampleFix":"# before\nvmOpts:\n  vz:\n    diskImageFormat: vhd\n# after\nvmOpts:\n  vz:\n    diskImageFormat: raw","handlingStrategy":"validation","validationCode":"f := instance.Config.VMOpts[\"vz\"].DiskImageFormat\nif f != \"\" && f != \"raw\" && f != \"asif\" {\n    // fail fast before CreateDisk\n}","typeGuard":"func macGuestDiskFormatOK(f string) bool {\n    return f == \"\" || f == \"raw\" || f == \"asif\"\n}","tryCatchPattern":"if err := driver.CreateDisk(ctx); err != nil {\n    if strings.Contains(err.Error(), \"unsupported disk format\") {\n        // correct vmOpts.vz.diskImageFormat and retry\n    }\n}","preventionTips":["Always run validateConfig before driver Create/CreateDisk","Only set diskImageFormat to 'raw' or 'asif' for macOS guests","Recreate instances after changing the format option"],"tags":["macos","vz","disk-image","config-validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}