{"record":{"id":"69978e941ee1a3c4","repo":"lima-vm/lima","slug":"w-q-unsupported-arch-q","errorCode":null,"errorMessage":"%w: %#q: unsupported arch: %#q","messagePattern":"%w: %#q: unsupported arch: %#q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/fileutils/download.go","lineNumber":24,"sourceCode":"import (\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"path\"\n\n\t\"github.com/sirupsen/logrus\"\n\n\t\"github.com/lima-vm/lima/v2/pkg/downloader\"\n\t\"github.com/lima-vm/lima/v2/pkg/limatype\"\n)\n\n// ErrSkipped is returned when the downloader did not attempt to download the specified file.\nvar ErrSkipped = errors.New(\"skipped to download\")\n\n// DownloadFile downloads a file to the cache, optionally copying it to the destination. Returns path in cache.\nfunc DownloadFile(ctx context.Context, dest string, f limatype.File, decompress bool, description string, expectedArch limatype.Arch, supportedImageFormats []string) (string, error) {\n\tif f.Arch != expectedArch {\n\t\treturn \"\", fmt.Errorf(\"%w: %#q: unsupported arch: %#q\", ErrSkipped, f.Location, f.Arch)\n\t}\n\tfields := logrus.Fields{\"location\": f.Location, \"arch\": f.Arch, \"digest\": f.Digest}\n\tlogrus.WithFields(fields).Infof(\"Attempting to download %s\", description)\n\topts := []downloader.Opt{\n\t\tdownloader.WithCache(),\n\t\tdownloader.WithDecompress(decompress),\n\t\tdownloader.WithDescription(fmt.Sprintf(\"%s (%s)\", description, path.Base(f.Location))),\n\t\tdownloader.WithExpectedDigest(f.Digest),\n\t}\n\tif len(supportedImageFormats) > 0 {\n\t\topts = append(opts, downloader.WithImageFormats(supportedImageFormats))\n\t}\n\n\tres, err := downloader.Download(ctx, dest, f.Location, opts...)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to download %#q: %w\", f.Location, err)\n\t}\n\tlogrus.Debugf(\"res.ValidatedDigest=%v\", res.ValidatedDigest)","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/fileutils/download.go#L6-L42","documentation":"DownloadFile returns this wrapped ErrSkipped error when the requested limatype.File has an architecture that does not match the expectedArch argument. The message includes the file location and both archs, telling the user the file was never downloaded because it targets a different architecture.","triggerScenarios":"Calling DownloadFile (directly or via EnsureNerdctlArchiveCache, Cmdline, EnsureFs, Prepare) with a file entry whose f.Arch differs from expectedArch — e.g. requesting an x86_64 nerdctl archive while running on arm64.","commonSituations":"Template YAML pointing at a single-arch image on a differently-arched host; copying a config between machines of different architectures; arch field typo in a custom file entry.","solutions":["Use a file Location matching the expected architecture (check both archs in the error message)","Switch the template to a multi-arch or correct-arch image URL","Correct the arch field in the custom file entry in lima.yaml","Run on/for the intended arch, or pass the matching expectedArch"],"exampleFix":"// before\narch: \"x86_64\"   # on an arm64 host\n// after\narch: \"aarch64\"  # or use an arch-neutral/multi-arch location","handlingStrategy":"validation","validationCode":"if f.Arch != runtimeArch {\n    return fmt.Errorf(\"file %s is for %s, need %s\", f.Location, f.Arch, runtimeArch)\n}","typeGuard":null,"tryCatchPattern":"path, err := fileutils.DownloadFile(ctx, dest, f, decompress, desc, arch, formats)\nif err != nil {\n    if errors.Is(err, fileutils.ErrSkipped) {\n        return fmt.Errorf(\"wrong-arch file %s: %w\", f.Location, err)\n    }\n    return err\n}","preventionTips":["Match file arch entries to the target instance arch","Prefer multi-arch image URLs in templates","Re-check arch fields when copying configs between hosts"],"tags":["download","arch-mismatch","validation"],"backgroundTag":"unsupported-architecture","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}