lima-vm/lima · error
invalid digest in raw digest file %q: %w
Error message
invalid digest in raw digest file %q: %w
What it means
When resolving a cached converted (raw) image, getCached reads the sidecar raw digest file and parses it with digest.Parse. If the stored digest string is malformed (e.g. missing "sha256:" prefix or non-hex characters), the parse failure is wrapped in this error and the cache resolution aborts.
Source
Thrown at pkg/downloader/downloader.go:360
converted, rawDigest, err := ensureRawInCache(ctx, shadData, imageFormat, o.expectedDigest)
if err != nil {
return nil, err
}
shadData = converted
if o.expectedDigest != "" {
o.expectedDigest = rawDigest
shadDigest = rawImgConvDigestPath
}
} else {
shadData = rawImgConvPath
if o.expectedDigest != "" {
if currentDigestData, err := os.ReadFile(rawImgConvDigestPath); err == nil {
currentDigest := strings.TrimSpace(string(currentDigestData))
if d, err := digest.Parse(currentDigest); err == nil {
o.expectedDigest = d
shadDigest = rawImgConvDigestPath
} else {
return nil, fmt.Errorf("invalid digest in raw digest file %q: %w", rawImgConvDigestPath, err)
}
} else {
return nil, fmt.Errorf("failed to read raw digest file %q: %w", rawImgConvDigestPath, err)
}
}
}
}
}
}
ext := path.Ext(remote)
logrus.Debugf("file %#q is cached as %#q", localPath, shadData)
if _, err := os.Stat(shadDigest); err == nil {
logrus.Debugf("Comparing digest %#q with the cached digest file %#q, not computing the actual digest of %#q",
o.expectedDigest, shadDigest, shadData)
if err := validateCachedDigest(shadDigest, o.expectedDigest); err != nil {
return nil, err
}View on GitHub (pinned to dd909d0973)
Solutions
- Delete the corrupted digest file (and its associated raw image) from the cache directory and re-run the download so it is regenerated.
- Ensure the digest file contains a valid form like "sha256:<64 hex chars>" if you maintain the cache manually.
- Clear the whole cache dir if multiple entries look corrupt.
Example fix
// before: cache contains 'abc123' (no algo prefix) -> invalid digest // after: fix the cache entry $ echo "sha256:<64-hex>" > ~/.cache/lima/images/<img>-raw.digest // or simply: $ rm ~/.cache/lima/images/<img>-raw.digest # forces regeneration
Defensive patterns
Strategy: validation
Validate before calling
data, err := os.ReadFile(digestPath)
if err == nil {
if _, err := digest.Parse(strings.TrimSpace(string(data))); err != nil {
os.Remove(digestPath) // purge corrupt cache entry before downloading
}
} Type guard
func isValidDigest(s string) bool {
_, err := digest.Parse(strings.TrimSpace(s))
return err == nil
} Try / catch
res, err := d.Download(ctx, "", url)
if err != nil && strings.Contains(err.Error(), "invalid digest in raw digest file") {
os.Remove(corruptDigestPath); res, err = d.Download(ctx, "", url) // retry after purge
} Prevention
- Never hand-edit files in the Lima cache directory.
- Avoid interrupting downloads/conversions (disk-full, SIGKILL) that can truncate digest files.
- Periodically prune and rebuild the cache rather than migrating it between machines.
When it happens
Trigger: A raw-image conversion digest file (rawImgConvDigestPath, e.g. <image>.digest under the imgConv cache dir) exists in the cache but its trimmed content is not a valid containerd-style digest, encountered during a cache-only Download.
Common situations: Cache files hand-edited or truncated by disk-full during a previous run; a cache written by an older Lima version with a different digest format; copying cache directories between machines with corruption.
Related errors
- caching-only mode requires the cache directory to be specifi
- failed to read raw digest file %q: %w
- failed to convert image to raw: %w
- failed to open raw tmp file %q: %w
- failed to stat raw tmp file %q: %w
AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01).
Data as JSON: /api/errors/da9d96cd8091f88b.
Report an issue: GitHub.