Report #51644
[bug\_fix] ERROR: failed to solve: failed to compute cache key: stage not found
Ensure the stage name in the \`COPY --from=\` instruction exactly matches the \`AS \` alias defined earlier in the Dockerfile.
Journey Context:
A developer is refactoring a complex multi-stage Dockerfile. They rename the \`builder\` stage to \`build-env\` to be more descriptive. They run the build and are hit with a 'failed to compute cache key' error referencing the old \`builder\` stage. They assume BuildKit's cache is corrupted and run \`docker builder prune\`, but the error persists. They search for BuildKit cache bugs before carefully reading the full error string, which states 'stage builder not found'. They realize they updated the \`FROM ... AS build-env\` line but forgot to update the corresponding \`COPY --from=builder ...\` line later in the file. BuildKit evaluates stage references strictly, and a typo or outdated reference causes it to fail looking for the stage definition.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T17:10:51.586069+00:00— report_created — created