lima-vm/lima · warning

%w: %#q: unsupported arch: %#q

Error message

%w: %#q: unsupported arch: %#q

What it means

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.

Source

Thrown at pkg/fileutils/download.go:24

import (
	"context"
	"errors"
	"fmt"
	"path"

	"github.com/sirupsen/logrus"

	"github.com/lima-vm/lima/v2/pkg/downloader"
	"github.com/lima-vm/lima/v2/pkg/limatype"
)

// ErrSkipped is returned when the downloader did not attempt to download the specified file.
var ErrSkipped = errors.New("skipped to download")

// DownloadFile downloads a file to the cache, optionally copying it to the destination. Returns path in cache.
func DownloadFile(ctx context.Context, dest string, f limatype.File, decompress bool, description string, expectedArch limatype.Arch, supportedImageFormats []string) (string, error) {
	if f.Arch != expectedArch {
		return "", fmt.Errorf("%w: %#q: unsupported arch: %#q", ErrSkipped, f.Location, f.Arch)
	}
	fields := logrus.Fields{"location": f.Location, "arch": f.Arch, "digest": f.Digest}
	logrus.WithFields(fields).Infof("Attempting to download %s", description)
	opts := []downloader.Opt{
		downloader.WithCache(),
		downloader.WithDecompress(decompress),
		downloader.WithDescription(fmt.Sprintf("%s (%s)", description, path.Base(f.Location))),
		downloader.WithExpectedDigest(f.Digest),
	}
	if len(supportedImageFormats) > 0 {
		opts = append(opts, downloader.WithImageFormats(supportedImageFormats))
	}

	res, err := downloader.Download(ctx, dest, f.Location, opts...)
	if err != nil {
		return "", fmt.Errorf("failed to download %#q: %w", f.Location, err)
	}
	logrus.Debugf("res.ValidatedDigest=%v", res.ValidatedDigest)

View on GitHub (pinned to dd909d0973)

Solutions

  1. Use a file Location matching the expected architecture (check both archs in the error message)
  2. Switch the template to a multi-arch or correct-arch image URL
  3. Correct the arch field in the custom file entry in lima.yaml
  4. Run on/for the intended arch, or pass the matching expectedArch

Example fix

// before
arch: "x86_64"   # on an arm64 host
// after
arch: "aarch64"  # or use an arch-neutral/multi-arch location
Defensive patterns

Strategy: validation

Validate before calling

if f.Arch != runtimeArch {
    return fmt.Errorf("file %s is for %s, need %s", f.Location, f.Arch, runtimeArch)
}

Try / catch

path, err := fileutils.DownloadFile(ctx, dest, f, decompress, desc, arch, formats)
if err != nil {
    if errors.Is(err, fileutils.ErrSkipped) {
        return fmt.Errorf("wrong-arch file %s: %w", f.Location, err)
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01). Data as JSON: /api/errors/69978e941ee1a3c4. Report an issue: GitHub.