lima-vm/lima · error

cache did not contain %#q

Error message

cache did not contain %#q

What it means

EnsureNerdctlArchiveCache downloads/validates the containerd (nerdctl) archive for the guest arch. DownloadFile returning an empty path with no error means the file was neither freshly downloaded nor found in the local cache; for a non-local (remote) Location that is an inconsistent state, so this error is thrown naming the URL that is missing from the cache.

Source

Thrown at pkg/cacheutil/cacheutil.go:55

	errs := make([]error, len(y.Containerd.Archives))
	for i, f := range y.Containerd.Archives {
		// Skip downloading again if the file is already in the cache
		if created && f.Arch == *y.Arch && !downloader.IsLocal(f.Location) {
			path, err := fileutils.CachedFile(f)
			if err == nil {
				return path, nil
			}
		}
		path, err := fileutils.DownloadFile(ctx, "", f, false, "the nerdctl archive", *y.Arch, nil)
		if err != nil {
			errs[i] = err
			continue
		}
		if path == "" {
			if downloader.IsLocal(f.Location) {
				return f.Location, nil
			}
			return "", fmt.Errorf("cache did not contain %#q", f.Location)
		}
		return path, nil
	}

	return "", fileutils.Errors(errs)
}

View on GitHub (pinned to dd909d0973)

Solutions

  1. Re-run the command (e.g. `limactl start`); the next attempt re-downloads the archive
  2. Clear the cache dir (~/.lima/_cache or ${LIMA_HOME}/_cache) and retry so the archive is fetched fresh
  3. Verify the containerd.archives URL for your arch is reachable (curl -I the Location) and matches your GOOS/GOARCH
  4. If using a local file, make sure Location points to an existing path — local paths are returned directly, so this error implies the remote path was taken

Example fix

# before: corrupt cache
ls ~/.lima/_cache
# after: purge and retry
rm -rf ~/.lima/_cache
limactl start default
Defensive patterns

Strategy: retry

Validate before calling

// Go: verify the archive URL for the current arch is set and reachable
for _, f := range y.Containerd.Archives {
    if f.Arch == *y.Arch {
        resp, err := http.Head(f.Location)
        if err != nil || resp.StatusCode >= 400 {
            // fix the URL or clear ~/.lima/_cache before starting
        }
    }
}

Try / catch

path, err := cacheutil.EnsureNerdctlArchiveCache(ctx, y, created)
if err != nil {
    if strings.Contains(err.Error(), "cache did not contain") {
        os.RemoveAll(filepath.Join(limainstance.LimaHome(), "_cache"))
        path, err = cacheutil.EnsureNerdctlArchiveCache(ctx, y, false)
    }
    if err != nil { return err }
}

Prevention

When it happens

Trigger: lima.yaml enables containerd (system or user) with a remote containerd.archives entry for the current arch; fileutils.DownloadFile returns path=="" (cache miss without download, e.g. cache index desync) and the location is not a local file, so the function cannot return any path.

Common situations: Corrupted or partially deleted ~/.lima/_cache downloads directory; URL whose cached file was removed between checks; misconfigured archive URL that redirects oddly; disk-full preventing the cache write while still returning an empty path on some paths.

Related errors


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