lima-vm/lima · error

field `mountType` must be one of %v for QEMU driver on Linux

Error message

field `mountType` must be one of %v for QEMU driver on Linux, got %#q

What it means

On Linux, the QEMU driver only supports revsshfs, 9p, and virtiofs as mountType. Any other value (e.g. reverse-sshfs misspelled, or a mount type valid only for other drivers like vz on macOS) fails validation with the allowed list and the offending value.

Source

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

	return nil
}

// Helper method for mount type validation.
func validateMountType(cfg *limatype.LimaYAML) error {
	// 1. First, check if the user explicitly blocked this mount type in their config.
	if cfg.MountTypesUnsupported != nil && cfg.MountType != nil && slices.Contains(cfg.MountTypesUnsupported, *cfg.MountType) {
		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:

View on GitHub (pinned to dd909d0973)

Solutions

  1. Set `mountType` to one of: revsshfs, 9p, virtiofs (exact strings, e.g. `mountType: virtiofs`).
  2. Remove the `mountType` field to use the default for the QEMU driver.
  3. If you need a mount type from another driver, switch drivers (e.g. vz on macOS) instead.

Example fix

# before
mountType: virtio-fs
// after
mountType: virtiofs
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

func validLinuxMountType(mt limatype.MountType) bool {
    switch mt {
    case limatype.REVSSHFS, limatype.NINEP, limatype.VIRTIOFS:
        return true
    }
    return false
}

Try / catch

if err := drv.Validate(ctx); err != nil && strings.Contains(err.Error(), "must be one of") && strings.Contains(err.Error(), "Linux") {
    // correct mountType in lima.yaml and re-validate
}

Prevention

When it happens

Trigger: lima.yaml with `mountType:` set to something other than revsshfs/9p/virtiofs while using the QEMU driver on a Linux host — e.g. `mountType: virtiofs-exporter`, `mountType: vz`, `mountType: native`.

Common situations: Copying a config written for the VZ driver on macOS to a Linux QEMU setup; typos like `9pv` or `virtio-fs`; older Lima mount type names removed in newer versions.

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