lima-vm/lima · error

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

Error message

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

What it means

Catch-all branch of validateMountType(): for any GOOS other than linux/darwin/windows (e.g. freebsd), the QEMU driver allows only revsshfs and 9p. The error names the OS via runtime.GOOS, the two allowed values, and the offending value.

Source

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

				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)
			}
		}
	}

	return nil
}

func fillConfig(cfg *limatype.LimaYAML, instDir string) error {
	if cfg.VMType == nil {
		cfg.VMType = new(limatype.QEMU)
	}

	if cfg.Video.VNC.Display == nil || *cfg.Video.VNC.Display == "" {
		cfg.Video.VNC.Display = new("127.0.0.1:0,to=9")
	}

	var qemuOpts limatype.QEMUOpts
	if err := limayaml.Convert(cfg.VMOpts[limatype.QEMU], &qemuOpts, "vmOpts.qemu"); err != nil {

View on GitHub (pinned to dd909d0973)

Solutions

  1. Set `mountType` to `revsshfs` or `9p` in lima.yaml.
  2. Remove the `mountType` field to use the platform default.
  3. Recognize that virtiofs is not supported under QEMU on this OS; choose 9p or revsshfs.

Example fix

# before
mountType: virtiofs
// after
mountType: 9p
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 %s; use one of %v", *cfg.MountType, runtime.GOOS, allowed)
}

Type guard

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

Try / catch

if err := drv.Validate(ctx); err != nil && strings.Contains(err.Error(), "QEMU driver on") {
    // set mountType to revsshfs or 9p for this platform and re-validate
}

Prevention

When it happens

Trigger: Running limactl with the QEMU driver on a non-linux/darwin/windows host with `mountType:` set to anything other than revsshfs or 9p (e.g. virtiofs).

Common situations: Experimental Lima setups on FreeBSD or other Unix-likes; configs copied from Linux where virtiofs was allowed.

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/36cca2861a4637fc. Report an issue: GitHub.