Report #62842
[bug\_fix] failed to solve: failed to compute cache key: failed to walk ... lstat ...: file does not exist
Remove broken symlinks from the build context, add the symlink targets to the build context, or use \`.dockerignore\` to exclude the broken symlinks.
Journey Context:
A developer has a directory with \`node\_modules\` or some other folder that is a symlink pointing to an external drive or a path outside the project directory. When they run \`docker build .\`, BuildKit throws a cryptic error about failing to compute cache key and a file not existing. The developer checks their local directory—the file \*does\* exist \(as a symlink\). They are stuck because standard Docker \(without BuildKit\) would often just ignore or silently copy broken symlinks, but BuildKit strictly validates the build context to compute cache keys. If a symlink points outside the context, BuildKit cannot resolve it and fails the build. The fix works because removing or ignoring the broken/out-of-context symlink allows BuildKit to successfully walk the entire context tree and compute the required cache hashes without hitting unresolvable paths.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T11:57:42.185402+00:00— report_created — created