{"record":{"id":"8982f91f38ecb00d","repo":"lima-vm/lima","slug":"field-mounttype-must-be-q-or-q-for-qemu-driv","errorCode":null,"errorMessage":"field `mountType` must be %#q or %#q for QEMU driver on macOS, got %#q","messagePattern":"field `mountType` must be %#q or %#q for QEMU driver on macOS, got %#q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/driver/qemu/qemu_driver.go","lineNumber":167,"sourceCode":"\t\treturn fmt.Errorf(\"mount type %#q is explicitly unsupported\", *cfg.MountType)\n\t}\n\n\t// 2. Then, check if the mount type is valid for the current Operating System.\n\tif cfg.MountType != nil {\n\t\tswitch runtime.GOOS {\n\t\tcase \"linux\":\n\t\t\tswitch *cfg.MountType {\n\t\t\tcase limatype.REVSSHFS, limatype.NINEP, limatype.VIRTIOFS:\n\t\t\t\treturn nil\n\t\t\tdefault:\n\t\t\t\treturn fmt.Errorf(\"field `mountType` must be one of %v for QEMU driver on Linux, got %#q\", []string{limatype.REVSSHFS, limatype.NINEP, limatype.VIRTIOFS}, *cfg.MountType)\n\t\t\t}\n\t\tcase \"darwin\":\n\t\t\tswitch *cfg.MountType {\n\t\t\tcase limatype.REVSSHFS, limatype.NINEP:\n\t\t\t\treturn nil\n\t\t\tdefault:\n\t\t\t\treturn fmt.Errorf(\"field `mountType` must be %#q or %#q for QEMU driver on macOS, got %#q\", limatype.REVSSHFS, limatype.NINEP, *cfg.MountType)\n\t\t\t}\n\t\tcase \"windows\":\n\t\t\t// Windows version of QEMU does not support 9p yet, so we should not suggest it.\n\t\t\t// https://gitlab.com/qemu-project/qemu/-/work_items/974\n\t\t\tswitch *cfg.MountType {\n\t\t\tcase limatype.REVSSHFS:\n\t\t\t\treturn nil\n\t\t\tdefault:\n\t\t\t\treturn fmt.Errorf(\"field `mountType` must be %#q for QEMU driver on Windows, got %#q\", limatype.REVSSHFS, *cfg.MountType)\n\t\t\t}\n\t\tdefault:\n\t\t\tswitch *cfg.MountType {\n\t\t\tcase limatype.REVSSHFS, limatype.NINEP:\n\t\t\t\treturn nil\n\t\t\tdefault:\n\t\t\t\treturn fmt.Errorf(\"field `mountType` must be %#q or %#q for QEMU driver on %s, got %#q\", limatype.REVSSHFS, limatype.NINEP, runtime.GOOS, *cfg.MountType)\n\t\t\t}\n\t\t}","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/driver/qemu/qemu_driver.go#L149-L185","documentation":"On macOS (darwin), the QEMU driver supports only revsshfs and 9p as mountType — notably virtiofs is not allowed under QEMU there (it is available only via the vz driver). Any other value fails with this message listing the two allowed options.","triggerScenarios":"lima.yaml with `mountType: virtiofs` (or anything else) while running the QEMU driver on a Mac.","commonSituations":"Apple Silicon users switching from the vz driver (which supports virtiofs) back to QEMU but keeping the old config; copying shared Linux examples that set virtiofs.","solutions":["Change `mountType` to `revsshfs` or `9p` in lima.yaml.","If you need virtiofs on macOS, switch to the VZ driver (`vmType: vz`) instead of QEMU.","Remove the field to accept the QEMU default."],"exampleFix":"# before\nmountType: virtiofs\n// after\nmountType: revsshfs","handlingStrategy":"validation","validationCode":"allowed := []string{\"revsshfs\", \"9p\"}\nif cfg.MountType != nil && !slices.Contains(allowed, string(*cfg.MountType)) {\n    return fmt.Errorf(\"mountType %q invalid for QEMU on macOS; use one of %v\", *cfg.MountType, allowed)\n}","typeGuard":"func validDarwinQEMUMountType(mt limatype.MountType) bool {\n    return mt == limatype.REVSSHFS || mt == limatype.NINEP\n}","tryCatchPattern":"if err := drv.Validate(ctx); err != nil && strings.Contains(err.Error(), \"on macOS\") {\n    // switch to revsshfs/9p, or switch vmType to vz for virtiofs\n}","preventionTips":["Never set mountType: virtiofs with QEMU on macOS — it requires the VZ driver.","When switching vmType between vz and qemu, review the mountType field too.","Validate templates after any host or driver change."],"tags":["qemu","mount","macos","validation"],"backgroundTag":"invalid-config-value","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}