{"record":{"id":"32efcc956171d794","repo":"lima-vm/lima","slug":"unsupported-image-type-for-s-q-s-only-support","errorCode":null,"errorMessage":"unsupported image type for %s: %q. %s only supports importing tar archive root filesystems, not standard VM disk images","messagePattern":"unsupported image type for (.+?): %q\\. (.+?) only supports importing tar archive root filesystems, not standard VM disk images","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/driver/wsl2/wsl_driver_windows.go","lineNumber":137,"sourceCode":"\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}\n\t\t\t\t\t\tif squashfsRegex.MatchString(location) {\n\t\t\t\t\t\t\treturn fmt.Errorf(\"unsupported image type for %s: %q. %s does not natively support importing SquashFS images; please convert the image to a tar archive before importing\", *cfg.VMType, location, *cfg.VMType)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn fmt.Errorf(\"unsupported image type for %s: %q. A tar archive root filesystem (.tar, .tar.gz, .tar.xz, etc.) is required\", *cfg.VMType, location)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif cfg.Mounts != nil {\n\t\t\tfor i, mount := range cfg.Mounts {\n\t\t\t\tif unknown := reflectutil.UnknownNonEmptyFields(mount); len(unknown) > 0 {\n\t\t\t\t\tlogrus.Warnf(\"Ignoring: vmType %s: mounts[%d]: %+v\", *cfg.VMType, i, unknown)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/driver/wsl2/wsl_driver_windows.go#L119-L155","documentation":"WSL2 instances import the guest root filesystem from a tar archive, not a VM disk image. When an image location matches the unsupportedVMImgRegex (standard VM disk images like .qcow2/.iso/.vhd), validation returns this error naming the vmType and location.","triggerScenarios":"An images[] entry whose Location is for the matching arch and whose filename looks like a VM disk image (not matching tarFileRegex, but matching unsupportedVMImgRegex), during wsl2 config validation.","commonSituations":"Pointing `images[].location` at a cloud image .qcow2 or .iso download (typical for QEMU) while using wsl2; reusing a QEMU template's image URLs on Windows.","solutions":["Replace the image with a tar-archive rootfs (.tar, .tar.gz, .tar.xz, etc.) for the target distro","Use a distro image known to work with WSL2 imports (e.g. an Ubuntu WSL rootfs tarball)","Keep separate templates for wsl2 vs qemu instead of sharing image URLs"],"exampleFix":"# before\nimages:\n  - location: https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img\n# after\nimages:\n  - location: https://cloud-images.ubuntu.com/wsl/releases/noble/current/ubuntu-noble-wsl-amd64-ubuntu24.04lts.rootfs.tar.gz","handlingStrategy":"validation","validationCode":"var tarRe = regexp.MustCompile(`\\.(tar|tgz|txz|tbz2|tzst|tar\\.(gz|xz|bz2|zstd|zst))$`)\nfunc imagesAreTarRootfs(cfg *limatype.LimaYAML) bool {\n\tif cfg.Images == nil { return true }\n\tfor _, img := range cfg.Images {\n\t\tif !tarRe.MatchString(img.Location) { return false }\n\t}\n\treturn true\n}","typeGuard":"func isTarRootfs(location string) bool {\n\tvar tarRe = regexp.MustCompile(`\\.(tar|tgz|txz|tbz2|tzst|tar\\.(gz|xz|bz2|zstd|zst))$`)\n\treturn tarRe.MatchString(location)\n}","tryCatchPattern":"if err := driver.Configure(ctx, cfg); err != nil {\n\tif strings.Contains(err.Error(), \"only supports importing tar archive\") {\n\t\t// swap image URL for a WSL rootfs tarball, then retry\n\t}\n\treturn err\n}","preventionTips":["Use WSL-specific rootfs tarball URLs in wsl2 templates","Do not copy qemu cloud-image (.img/.qcow2/.iso) URLs into wsl2 configs","Validate image URLs/extension early in CI"],"tags":["wsl2","image-format","config-validation"],"backgroundTag":"unsupported-image-format","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}