{"record":{"id":"da9d96cd8091f88b","repo":"lima-vm/lima","slug":"invalid-digest-in-raw-digest-file-q-w","errorCode":null,"errorMessage":"invalid digest in raw digest file %q: %w","messagePattern":"invalid digest in raw digest file %q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/downloader/downloader.go","lineNumber":360,"sourceCode":"\t\t\t\t\tconverted, rawDigest, err := ensureRawInCache(ctx, shadData, imageFormat, o.expectedDigest)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\t\t\t\t\tshadData = converted\n\t\t\t\t\tif o.expectedDigest != \"\" {\n\t\t\t\t\t\to.expectedDigest = rawDigest\n\t\t\t\t\t\tshadDigest = rawImgConvDigestPath\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tshadData = rawImgConvPath\n\t\t\t\t\tif o.expectedDigest != \"\" {\n\t\t\t\t\t\tif currentDigestData, err := os.ReadFile(rawImgConvDigestPath); err == nil {\n\t\t\t\t\t\t\tcurrentDigest := strings.TrimSpace(string(currentDigestData))\n\t\t\t\t\t\t\tif d, err := digest.Parse(currentDigest); err == nil {\n\t\t\t\t\t\t\t\to.expectedDigest = d\n\t\t\t\t\t\t\t\tshadDigest = rawImgConvDigestPath\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\treturn nil, fmt.Errorf(\"invalid digest in raw digest file %q: %w\", rawImgConvDigestPath, err)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn nil, fmt.Errorf(\"failed to read raw digest file %q: %w\", rawImgConvDigestPath, err)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\text := path.Ext(remote)\n\tlogrus.Debugf(\"file %#q is cached as %#q\", localPath, shadData)\n\tif _, err := os.Stat(shadDigest); err == nil {\n\t\tlogrus.Debugf(\"Comparing digest %#q with the cached digest file %#q, not computing the actual digest of %#q\",\n\t\t\to.expectedDigest, shadDigest, shadData)\n\t\tif err := validateCachedDigest(shadDigest, o.expectedDigest); err != nil {\n\t\t\treturn nil, err\n\t\t}","sourceCodeStart":342,"sourceCodeEnd":378,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/downloader/downloader.go#L342-L378","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before: cache contains 'abc123' (no algo prefix) -> invalid digest\n// after: fix the cache entry\n$ echo \"sha256:<64-hex>\" > ~/.cache/lima/images/<img>-raw.digest\n// or simply:\n$ rm ~/.cache/lima/images/<img>-raw.digest  # forces regeneration","handlingStrategy":"validation","validationCode":"data, err := os.ReadFile(digestPath)\nif err == nil {\n    if _, err := digest.Parse(strings.TrimSpace(string(data))); err != nil {\n        os.Remove(digestPath) // purge corrupt cache entry before downloading\n    }\n}","typeGuard":"func isValidDigest(s string) bool {\n    _, err := digest.Parse(strings.TrimSpace(s))\n    return err == nil\n}","tryCatchPattern":"res, err := d.Download(ctx, \"\", url)\nif err != nil && strings.Contains(err.Error(), \"invalid digest in raw digest file\") {\n    os.Remove(corruptDigestPath); res, err = d.Download(ctx, \"\", url) // retry after purge\n}","preventionTips":["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."],"tags":["downloader","cache","digest","corruption"],"backgroundTag":"invalid-digest","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}