{"record":{"id":"ce2e9d99573a4e6d","repo":"lima-vm/lima","slug":"w-variant-mismatch-expected-q-got-q","errorCode":null,"errorMessage":"%w: variant mismatch (expected %q, got %q)","messagePattern":"%w: variant mismatch \\(expected %q, got %q\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/instance/start.go","lineNumber":123,"sourceCode":"\t\tvar ensuredImage bool\n\t\tvar targetVariant, targetArchVariant string\n\t\tvar targetVariantSet bool\n\t\tfor _, img := range inst.Config.Images {\n\t\t\tif img.Arch == *inst.Config.Arch {\n\t\t\t\ttargetVariant = img.Variant\n\t\t\t\ttargetArchVariant = img.ArchVariant\n\t\t\t\ttargetVariantSet = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif len(inst.Config.Images) == 0 {\n\t\t\treturn nil, errors.New(\"no images are configured (did you set --image-variant or --arch-variant to a value not present in the template?)\")\n\t\t}\n\t\terrs := make([]error, len(inst.Config.Images))\n\t\tfor i, f := range inst.Config.Images {\n\t\t\tif targetVariantSet && f.Variant != targetVariant {\n\t\t\t\terrs[i] = fmt.Errorf(\"%w: variant mismatch (expected %q, got %q)\", fileutils.ErrSkipped, targetVariant, f.Variant)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif targetVariantSet && f.ArchVariant != targetArchVariant {\n\t\t\t\terrs[i] = fmt.Errorf(\"%w: archVariant mismatch (expected %q, got %q)\", fileutils.ErrSkipped, targetArchVariant, f.ArchVariant)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif _, err := fileutils.DownloadFile(ctx, imagePath, f.File, true, \"the image\", *inst.Config.Arch, supportedImageFormats); err != nil {\n\t\t\t\terrs[i] = err\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif f.Kernel != nil {\n\t\t\t\t// ensure decompress kernel because vz expects it to be decompressed\n\t\t\t\tif _, err := fileutils.DownloadFile(ctx, kernel, f.Kernel.File, true, \"the kernel\", *inst.Config.Arch, nil); err != nil {\n\t\t\t\t\terrs[i] = err\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif f.Kernel.Cmdline != \"\" {\n\t\t\t\t\tif err := os.WriteFile(kernelCmdline, []byte(f.Kernel.Cmdline), 0o644); err != nil {","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/instance/start.go#L105-L141","documentation":"When --image-variant is set, Prepare collects per-image errors instead of failing fast: any image whose Variant differs from the requested targetVariant is recorded as a fileutils.ErrSkipped \"variant mismatch\" entry. These skipped entries surface if no image matched at all.","triggerScenarios":"`limactl create/start --image-variant=<v>` where the template's images carry a different Variant field, e.g. requesting 12.04 variant against images tagged with standard/default variants.","commonSituations":"Mixing image variants across templates (standard, upgrade-only, test variants); scripts hardcoding a variant name that changed between Lima versions; requesting \"desktop\" on server-only templates.","solutions":["List the template's images to confirm exact variant strings, then pass the matching --image-variant value.","Omit --image-variant so the default image is chosen.","Edit the instance/template YAML to add an image entry with the wanted variant.","Fix the flag casing/spelling - the match is exact string comparison."],"exampleFix":"// before\nlimactl create template://ubuntu-24.04 --image-variant=desktop\n// after\nlimactl create template://ubuntu-24.04 --image-variant=default","handlingStrategy":"validation","validationCode":"// match your flag against the template's declared variants\nvar found bool\nfor _, img := range tmpl.Images {\n  if string(img.Variant) == requestedVariant { found = true }\n}\nif !found { return fmt.Errorf(\"--image-variant %q not offered by template\", requestedVariant) }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use exact variant strings from the template YAML","Remember the comparison is exact (case-sensitive) string equality","Re-check flags when switching templates","Prefer omitting --image-variant unless you need a specific one"],"tags":["images","variant","flag"],"backgroundTag":"no-matching-image-variant","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}