{"record":{"id":"009e5cd84a7b2d80","repo":"lima-vm/lima","slug":"unsupported-arch-q-009e5c","errorCode":null,"errorMessage":"unsupported arch: %#q","messagePattern":"unsupported arch: %#q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/driver/wsl2/wsl_driver_windows.go","lineNumber":116,"sourceCode":"\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\")\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","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/driver/wsl2/wsl_driver_windows.go#L98-L134","documentation":"validateConfig rejects CPU architectures that do not match the native host architecture, since WSL2 cannot run foreign-architecture guests. The message interpolates the offending arch value with %#q. It is a hard config error returned before instance creation.","triggerScenarios":"A lima.yaml with `arch: aarch64` (or x86_64/arm64 mismatching the host) passed to the wsl2 driver, when limatype.IsNativeArch(*cfg.Arch) returns false. Hit via Configure, Validate, or limactl create/start.","commonSituations":"Copying a config made for an ARM machine onto an x86_64 Windows box (or vice versa); explicit arch pinning in templates; CI machines with a different arch than the developer's config.","solutions":["Remove the explicit `arch:` field so Lima defaults to the native architecture","Set `arch:` to the host architecture (e.g. x86_64 on typical Windows PCs)","Use a driver that supports emulation (e.g. qemu with Rosetta/TCG) if a foreign arch is required"],"exampleFix":"# before (on x86_64 host)\narch: aarch64\nvmType: wsl2\n# after\narch: x86_64\nvmType: wsl2","handlingStrategy":"validation","validationCode":"import \"github.com/lima-vm/lima/v2/pkg/limatype\"\nfunc validArchForWSL2(cfg *limatype.LimaYAML) bool {\n\treturn cfg.Arch == nil || limatype.IsNativeArch(*cfg.Arch)\n}\n// check before handing cfg to the wsl2 driver","typeGuard":"func isForeignArch(cfg *limatype.LimaYAML) bool {\n\treturn cfg.Arch != nil && !limatype.IsNativeArch(*cfg.Arch)\n}","tryCatchPattern":"if err := driver.Configure(ctx, cfg); err != nil {\n\tif strings.Contains(err.Error(), \"unsupported arch:\") {\n\t\tcfg.Arch = nil // let Lima default to native arch, retry\n\t\treturn driver.Configure(ctx, cfg)\n\t}\n\treturn err\n}","preventionTips":["Omit the arch field unless you specifically need it","Match arch to the host when targeting wsl2","Validate templates on every target host architecture in CI"],"tags":["wsl2","config-validation","architecture"],"backgroundTag":"unsupported-architecture","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}