{"record":{"id":"c99d3da785dbb363","repo":"lima-vm/lima","slug":"field-mounttype-must-be-q-for-wsl2-driver-got","errorCode":null,"errorMessage":"field `mountType` must be %#q for WSL2 driver, got %#q","messagePattern":"field `mountType` must be %#q for WSL2 driver, got %#q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/driver/wsl2/wsl_driver_windows.go","lineNumber":102,"sourceCode":"\n\tl.Instance = inst\n\tl.SSHLocalPort = inst.SSHLocalPort\n\n\treturn &driver.ConfiguredDriver{\n\t\tDriver: l,\n\t}, nil\n}\n\nfunc (l *LimaWslDriver) Validate(ctx context.Context) error {\n\treturn validateConfig(ctx, l.Instance.Config)\n}\n\nfunc validateConfig(_ context.Context, cfg *limatype.LimaYAML) error {\n\tif cfg == nil {\n\t\treturn errors.New(\"configuration is nil\")\n\t}\n\tif cfg.MountType != nil && *cfg.MountType != limatype.WSLMount {\n\t\treturn fmt.Errorf(\"field `mountType` must be %#q for WSL2 driver, got %#q\", limatype.WSLMount, *cfg.MountType)\n\t}\n\t// TODO: revise this list for WSL2\n\tif cfg.VMType != nil {\n\t\tif unknown := reflectutil.UnknownNonEmptyFields(cfg, knownYamlProperties...); len(unknown) > 0 {\n\t\t\tlogrus.Warnf(\"Ignoring: vmType %s: %+v\", *cfg.VMType, unknown)\n\t\t}\n\t}\n\n\tif cfg.OS != nil && *cfg.OS == limatype.WINDOWS {\n\t\treturn errors.New(\"currently Windows guest OS is only supported on QEMU\")\n\t}\n\n\tif !limatype.IsNativeArch(*cfg.Arch) {\n\t\treturn fmt.Errorf(\"unsupported arch: %#q\", *cfg.Arch)\n\t}\n\n\tif cfg.TPM != nil && *cfg.TPM {\n\t\treturn errors.New(\"field `tpm` is not supported on WSL2 driver\")","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/driver/wsl2/wsl_driver_windows.go#L84-L120","documentation":"The WSL2 driver only supports the WSL reverse-sshfs/9p style mount; validateConfig rejects any explicitly set mountType other than WSLMount. This catches YAML configs written for qemu/vz being reused with the WSL2 driver.","triggerScenarios":"lima.yaml contains `mountType: virtiofs` (or sshfs/9p/native) while vmType is wsl2; validateConfig runs during create/start validation and rejects the combination.","commonSituations":"Copying a macOS qemu/vz Lima YAML to a Windows WSL2 machine; explicitly setting virtiofs out of habit; templates defaulting to a non-WSL mount type.","solutions":["Remove the `mountType` line from the YAML so the WSL2 default applies","Or set `mountType: wsl2` explicitly in lima.yaml","Re-run `limactl start`; use `limactl edit` to fix an existing instance's config"],"exampleFix":"// before\nmountType: virtiofs\n// after\nmountType: wsl2   # or omit entirely; WSL2 driver defaults to wsl2","handlingStrategy":"validation","validationCode":"// Validate mountType compatibility before starting a wsl2 instance\nconst cfg = yaml.parse(fs.readFileSync('lima.yaml', 'utf8'));\nif (cfg.vmType === 'wsl2' && cfg.mountType && cfg.mountType !== 'wsl2') {\n  throw new Error(`mountType ${cfg.mountType} unsupported for wsl2; use wsl2 or remove the field`);\n}","typeGuard":"null","tryCatchPattern":"try {\n  await limactlStart(inst);\n} catch (e) {\n  if (/mountType.*must be/.test(String(e))) {\n    console.error('Fix lima.yaml: set mountType: wsl2 (or remove it) and retry');\n  } else throw e;\n}","preventionTips":["Omit mountType entirely for WSL2 instances so defaults apply","Never copy qemu/vz lima.yaml mount settings to WSL2 hosts","Run `limactl validate lima.yaml` (or start) before distributing templates","Keep templates per-driver rather than sharing one config across qemu/vz/wsl2"],"tags":["wsl2","validation","mounttype","config"],"backgroundTag":"unsupported-config-value","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}