Report #9542
[bug\_fix] failed to solve: failed to compute cache key: failed to walk /...: lstat /app/dist: no such file or directory
Ensure the build tool in the earlier stage actually outputs files to the expected directory, and that the \`COPY --from=\` path exactly matches. The root cause is that the \`COPY --from=builder\` instruction is trying to copy a file/directory that was never created in the previous stage, often due to a failing build command that didn't exit with a non-zero code, or a path mismatch.
Journey Context:
A developer sets up a multi-stage build. Stage 1 \(\`builder\`\) runs \`npm run build\` which compiles TypeScript to a \`dist/\` folder. Stage 2 \(\`runner\`\) does \`COPY --from=builder /app/dist /app/dist\`. The build fails with a cache key/lstat error. The developer is confused because \`npm run build\` didn't throw an error in the logs. They inspect the builder stage by running a shell in it \(\`docker build --target builder ...\`\) and find that \`dist/\` is empty because the TypeScript compiler wrote to \`build/\` instead, or the working directory was misconfigured. The fix is correcting the output path in the build command or the \`COPY\` instruction to match the actual artifact location.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T08:24:28.279365+00:00— report_created — created