lima-vm/lima · error

field `mountType` must be %#q or %#q for QEMU driver on macO

Error message

field `mountType` must be %#q or %#q for QEMU driver on macOS, got %#q

What it means

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.

Source

Thrown at pkg/driver/qemu/qemu_driver.go:167

		return fmt.Errorf("mount type %#q is explicitly unsupported", *cfg.MountType)
	}

	// 2. Then, check if the mount type is valid for the current Operating System.
	if cfg.MountType != nil {
		switch runtime.GOOS {
		case "linux":
			switch *cfg.MountType {
			case limatype.REVSSHFS, limatype.NINEP, limatype.VIRTIOFS:
				return nil
			default:
				return 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)
			}
		case "darwin":
			switch *cfg.MountType {
			case limatype.REVSSHFS, limatype.NINEP:
				return nil
			default:
				return fmt.Errorf("field `mountType` must be %#q or %#q for QEMU driver on macOS, got %#q", limatype.REVSSHFS, limatype.NINEP, *cfg.MountType)
			}
		case "windows":
			// Windows version of QEMU does not support 9p yet, so we should not suggest it.
			// https://gitlab.com/qemu-project/qemu/-/work_items/974
			switch *cfg.MountType {
			case limatype.REVSSHFS:
				return nil
			default:
				return fmt.Errorf("field `mountType` must be %#q for QEMU driver on Windows, got %#q", limatype.REVSSHFS, *cfg.MountType)
			}
		default:
			switch *cfg.MountType {
			case limatype.REVSSHFS, limatype.NINEP:
				return nil
			default:
				return fmt.Errorf("field `mountType` must be %#q or %#q for QEMU driver on %s, got %#q", limatype.REVSSHFS, limatype.NINEP, runtime.GOOS, *cfg.MountType)
			}
		}

View on GitHub (pinned to dd909d0973)

Solutions

  1. Change `mountType` to `revsshfs` or `9p` in lima.yaml.
  2. If you need virtiofs on macOS, switch to the VZ driver (`vmType: vz`) instead of QEMU.
  3. Remove the field to accept the QEMU default.

Example fix

# before
mountType: virtiofs
// after
mountType: revsshfs
Defensive patterns

Strategy: validation

Validate before calling

allowed := []string{"revsshfs", "9p"}
if cfg.MountType != nil && !slices.Contains(allowed, string(*cfg.MountType)) {
    return fmt.Errorf("mountType %q invalid for QEMU on macOS; use one of %v", *cfg.MountType, allowed)
}

Type guard

func validDarwinQEMUMountType(mt limatype.MountType) bool {
    return mt == limatype.REVSSHFS || mt == limatype.NINEP
}

Try / catch

if err := drv.Validate(ctx); err != nil && strings.Contains(err.Error(), "on macOS") {
    // switch to revsshfs/9p, or switch vmType to vz for virtiofs
}

Prevention

When it happens

Trigger: lima.yaml with `mountType: virtiofs` (or anything else) while running the QEMU driver on a Mac.

Common situations: 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.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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