lima-vm/lima · error
field `mountType` must be %#q for WSL2 driver, got %#q
Error message
field `mountType` must be %#q for WSL2 driver, got %#q
What it means
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.
Source
Thrown at pkg/driver/wsl2/wsl_driver_windows.go:102
l.Instance = inst
l.SSHLocalPort = inst.SSHLocalPort
return &driver.ConfiguredDriver{
Driver: l,
}, nil
}
func (l *LimaWslDriver) Validate(ctx context.Context) error {
return validateConfig(ctx, l.Instance.Config)
}
func validateConfig(_ context.Context, cfg *limatype.LimaYAML) error {
if cfg == nil {
return errors.New("configuration is nil")
}
if cfg.MountType != nil && *cfg.MountType != limatype.WSLMount {
return fmt.Errorf("field `mountType` must be %#q for WSL2 driver, got %#q", limatype.WSLMount, *cfg.MountType)
}
// TODO: revise this list for WSL2
if cfg.VMType != nil {
if unknown := reflectutil.UnknownNonEmptyFields(cfg, knownYamlProperties...); len(unknown) > 0 {
logrus.Warnf("Ignoring: vmType %s: %+v", *cfg.VMType, unknown)
}
}
if cfg.OS != nil && *cfg.OS == limatype.WINDOWS {
return errors.New("currently Windows guest OS is only supported on QEMU")
}
if !limatype.IsNativeArch(*cfg.Arch) {
return fmt.Errorf("unsupported arch: %#q", *cfg.Arch)
}
if cfg.TPM != nil && *cfg.TPM {
return errors.New("field `tpm` is not supported on WSL2 driver")View on GitHub (pinned to dd909d0973)
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
Example fix
// before mountType: virtiofs // after mountType: wsl2 # or omit entirely; WSL2 driver defaults to wsl2
Defensive patterns
Strategy: validation
Validate before calling
// Validate mountType compatibility before starting a wsl2 instance
const cfg = yaml.parse(fs.readFileSync('lima.yaml', 'utf8'));
if (cfg.vmType === 'wsl2' && cfg.mountType && cfg.mountType !== 'wsl2') {
throw new Error(`mountType ${cfg.mountType} unsupported for wsl2; use wsl2 or remove the field`);
} Type guard
null
Try / catch
try {
await limactlStart(inst);
} catch (e) {
if (/mountType.*must be/.test(String(e))) {
console.error('Fix lima.yaml: set mountType: wsl2 (or remove it) and retry');
} else throw e;
} Prevention
- 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
When it happens
Trigger: lima.yaml contains `mountType: virtiofs` (or sshfs/9p/native) while vmType is wsl2; validateConfig runs during create/start validation and rejects the combination.
Common situations: 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.
Related errors
- the YAML is invalid, saved the buffer as %#q: %w
- field `vmOpts.qemu.minimumVersion` must be a semvar value, g
- configuration is nil
- failed to validate the instance YAML after filling defaults:
- invalid ssh local port %d
AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01).
Data as JSON: /api/errors/c99d3da785dbb363.
Report an issue: GitHub.