Report #93747
[bug\_fix] COPY --from= failed: is not a valid stage name or stage not found
Verify the stage name in \`FROM ... AS \` matches the \`--from=\` reference exactly \(case-sensitive\). Ensure the referenced stage is defined before the COPY instruction in the Dockerfile. Avoid using reserved names like \`scratch\` as custom stage names.
Journey Context:
A developer writes a multi-stage Dockerfile with \`FROM node:18 AS builder\` and later \`FROM python:3.11 AS runtime\` with \`COPY --from=Builder /app/dist ./dist\`. The build fails because 'Builder' \(capital B\) doesn't match 'builder' \(lowercase b\). Stage names are case-sensitive. In another scenario, the developer defines the builder stage after the runtime stage but tries to COPY from it—Docker processes stages in order, so the source stage must appear before any COPY that references it. After carefully checking for typos and reordering stages, the build succeeds. This error is especially common when refactoring Dockerfiles or when multiple developers contribute to the same Dockerfile with inconsistent naming conventions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T15:56:29.382037+00:00— report_created — created