{"record":{"id":"ecd75110b44df4b1","repo":"lima-vm/lima","slug":"field-tpm-is-not-supported-on-wsl2-driver","errorCode":null,"errorMessage":"field `tpm` is not supported on WSL2 driver","messagePattern":"field `tpm` is not supported on WSL2 driver","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/driver/wsl2/wsl_driver_windows.go","lineNumber":120,"sourceCode":"\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\")\n\t}\n\n\tif cfg.VMType != nil {\n\t\tif cfg.Images != nil && cfg.Arch != nil {\n\t\t\t// TODO: real filetype checks\n\t\t\ttarFileRegex := regexp.MustCompile(`\\.(tar|tgz|txz|tbz2|tzst|tar\\.(gz|xz|bz2|zstd|zst))$`)\n\t\t\tunsupportedVMImgRegex := regexp.MustCompile(`\\.(qcow2|raw|img|iso|ipsw)(\\.(gz|xz|bz2|zstd|zst))?$`)\n\t\t\tsquashfsRegex := regexp.MustCompile(`\\.squashfs(\\.(gz|xz|bz2|zstd|zst))?$`)\n\t\t\tfor i, image := range cfg.Images {\n\t\t\t\tif unknown := reflectutil.UnknownNonEmptyFields(image, \"File\", \"Variant\", \"ArchVariant\"); len(unknown) > 0 {\n\t\t\t\t\tlogrus.Warnf(\"Ignoring: vmType %s: images[%d]: %+v\", *cfg.VMType, i, unknown)\n\t\t\t\t}\n\t\t\t\tif image.Arch == *cfg.Arch {\n\t\t\t\t\tlocation := image.Location\n\t\t\t\t\tif !tarFileRegex.MatchString(location) {\n\t\t\t\t\t\tif unsupportedVMImgRegex.MatchString(location) {\n\t\t\t\t\t\t\treturn fmt.Errorf(\"unsupported image type for %s: %q. %s only supports importing tar archive root filesystems, not standard VM disk images\", *cfg.VMType, location, *cfg.VMType)\n\t\t\t\t\t\t}","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/driver/wsl2/wsl_driver_windows.go#L102-L138","documentation":"The WSL2 driver does not implement a virtual TPM, so a config with `tpm: true` is rejected during validation. TPM in Lima is used for things like Windows 11 guests and SecureBoot scenarios, none of which apply to wsl2.","triggerScenarios":"`tpm: true` in lima.yaml while vmType is wsl2; validateConfig checks cfg.TPM != nil && *cfg.TPM and returns this error. Reached through Configure/Validate/limactl create/start.","commonSituations":"Configs shared from QEMU users enabling tpm for Windows 11 or vTPM-based encryption experiments being reused on WSL2; template experimentation.","solutions":["Remove or set `tpm: false` in lima.yaml","Switch to the qemu driver if a TPM is required","Validate the template with `limactl validate` before creating"],"exampleFix":"# before\ntpm: true\nvmType: wsl2\n# after\n# remove 'tpm' line, or:\ntpm: false\nvmType: wsl2","handlingStrategy":"validation","validationCode":"func hasTPM(cfg *limatype.LimaYAML) bool {\n\treturn cfg.TPM != nil && *cfg.TPM\n}\n// reject or clear cfg.TPM before wsl2 Configure","typeGuard":"func tpmRequested(cfg *limatype.LimaYAML) bool {\n\treturn cfg.TPM != nil && bool(*cfg.TPM)\n}","tryCatchPattern":"if err := driver.Configure(ctx, cfg); err != nil {\n\tif strings.Contains(err.Error(), \"`tpm` is not supported\") {\n\t\tcfg.TPM = nil // or switch to qemu driver\n\t\treturn driver.Configure(ctx, cfg)\n\t}\n\treturn err\n}","preventionTips":["Only enable tpm for drivers that support it (e.g. qemu)","Do not blindly share Windows-11-style configs with wsl2 users","Run limactl validate on templates before distribution"],"tags":["wsl2","config-validation","tpm"],"backgroundTag":"unsupported-driver-field","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}