{"record":{"id":"ffc0423dd1c5bd5f","repo":"lima-vm/lima","slug":"failed-to-read-raw-digest-file-q-w","errorCode":null,"errorMessage":"failed to read raw digest file %q: %w","messagePattern":"failed to read raw digest file %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/downloader/downloader.go","lineNumber":363,"sourceCode":"\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}\n\t\tif err := copyLocal(ctx, localPath, shadData, ext, o.decompress, \"\", \"\"); err != nil {\n\t\t\treturn nil, err\n\t\t}","sourceCodeStart":345,"sourceCodeEnd":381,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/downloader/downloader.go#L345-L381","documentation":"Companion to the invalid-digest case: getCached attempted to read the raw-image conversion digest file from the cache, but the read failed (file missing at that moment, permission denied, I/O error). The OS error is wrapped in this message.","triggerScenarios":"During cache resolution, os.ReadFile(rawImgConvDigestPath) fails — e.g. permissions changed on ~/.cache/lima, the digest file was deleted between existence checks and reads, or NFS/home-dir sync issues make the file unreadable.","commonSituations":"Cache directory owned by another user (ran lima with sudo previously); read-only cache mounts; corrupted filesystems.","solutions":["Check and fix permissions on the cache directory: `ls -l` the digest path; chown/chmod as needed.","Remove the unreadable digest file so the cache entry is rebuilt from scratch.","Verify the cache directory is on a writable, local filesystem."],"exampleFix":"// before: permission denied reading ~/.cache/lima/.../raw.digest\n$ sudo chown -R $(id -u):$(id -g) ~/.cache/lima\n// after: read succeeds, download proceeds from cache","handlingStrategy":"validation","validationCode":"if f, err := os.Open(digestPath); err != nil {\n    return fmt.Errorf(\"cache unreadable, remove or fix permissions: %w\", err)\n} else {\n    f.Close()\n}","typeGuard":null,"tryCatchPattern":"res, err := d.Download(ctx, \"\", url)\nif err != nil && strings.Contains(err.Error(), \"failed to read raw digest file\") {\n    // check cache perms/ownership, purge entry, retry\n}","preventionTips":["Run all limactl operations as the same user to keep cache ownership consistent.","Keep CacheDir on a local writable filesystem, not read-only or flaky network mounts.","Preload/read the digest path before cache-only downloads in scripts."],"tags":["downloader","cache","file-io","permissions"],"backgroundTag":"cache-read-failure","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}