{"record":{"id":"5ece1d7fa33f534a","repo":"lima-vm/lima","slug":"expected-the-format-of-q-to-be-one-of-v-got","errorCode":null,"errorMessage":"expected the format of %#q to be one of %v, got %#q","messagePattern":"expected the format of %#q to be one of (.+?), got %#q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/driver/vz/vm_darwin.go","lineNumber":541,"sourceCode":"\t\t}\n\t}\n\tvmConfig.SetNetworkDevicesVirtualMachineConfiguration(configurations)\n\treturn nil\n}\n\nfunc validateDiskFormat(diskPath string) error {\n\tf, err := os.Open(diskPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\timg, err := qcow2reader.Open(f)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to detect the format of %#q: %w\", diskPath, err)\n\t}\n\tsupportedDiskTypes := []image.Type{raw.Type, asif.Type}\n\tif t := img.Type(); !slices.Contains(supportedDiskTypes, t) {\n\t\treturn fmt.Errorf(\"expected the format of %#q to be one of %v, got %#q\", diskPath, supportedDiskTypes, t)\n\t}\n\t// TODO: ensure that the disk is formatted with GPT or ISO9660\n\treturn nil\n}\n\nfunc attachDisks(ctx context.Context, inst *limatype.Instance, vmConfig *vz.VirtualMachineConfiguration) error {\n\tdiskPath := filepath.Join(inst.Dir, filenames.Disk)\n\tisoPath := filepath.Join(inst.Dir, filenames.ISO)\n\tciDataPath := filepath.Join(inst.Dir, filenames.CIDataISO)\n\tvar configurations []vz.StorageDeviceConfiguration\n\n\tif osutil.FileExists(diskPath) {\n\t\tif err := validateDiskFormat(diskPath); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdiskAttachment, err := vz.NewDiskImageStorageDeviceAttachmentWithCacheAndSync(diskPath, false, diskImageCachingMode, vz.DiskImageSynchronizationModeFsync)\n\t\tif err != nil {\n\t\t\treturn err","sourceCodeStart":523,"sourceCodeEnd":559,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/driver/vz/vm_darwin.go#L523-L559","documentation":"The image format was detected, but it is not one of raw or ASIF, the only formats the vz driver supports for disk attachments. Any other format (e.g. qcow2, vhd, iso detected differently) is rejected before the VM is created.","triggerScenarios":"attachDisks -> validateDiskFormat finds img.Type() not in {raw.Type, asif.Type} — e.g. handing vz a qcow2 image or other container format.","commonSituations":"Reusing disks created for the qemu driver (qcow2); converting tools produced vpc/vdi; older Lima disks in a format vz never supported.","solutions":["Convert the image to raw: `qemu-img convert -O raw in.qcow2 out.raw` or rely on Lima's Convert step for additional disks","Recreate the disk in ASIF format on macOS hosts that support it","Use the qemu driver if you need qcow2 disks directly"],"exampleFix":"// before\nqemu-img create -f qcow2 disk.qcow2 10G\n// after\nqemu-img convert -O raw disk.qcow2 disk.raw","handlingStrategy":"validation","validationCode":"out, _ := exec.Command(\"qemu-img\", \"info\", \"--output=json\", diskPath).Output()\nvar info map[string]any\njson.Unmarshal(out, &info)\nif info[\"format\"] != \"raw\" {\n    return fmt.Errorf(\"convert %s to raw before using the vz driver\", diskPath)\n}","typeGuard":null,"tryCatchPattern":"if err := start(); err != nil {\n    if strings.Contains(err.Error(), \"expected the format\") {\n        // run qemu-img convert -O raw and retry\n    }\n}","preventionTips":["Standardize on raw disks for vz-driver instances","Convert qcow2 disks when migrating instances from qemu to vz","Add a pre-flight check in tooling that inspects image format"],"tags":["disk-image","vz-driver","unsupported-format"],"backgroundTag":"disk-image-format-unsupported","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}