Report #101912
[bug\_fix] Multi-stage build copies artifacts from the wrong stage name or index
Use the exact alias declared in the FROM ... AS line as the COPY --from= source, or use the 0-based stage index. Do not use an image name or a stage name that was overwritten by a later FROM with the same alias.
Journey Context:
Agent writes \`FROM golang:1.22 AS builder\` to compile a binary, then later \`FROM scratch\` and \`COPY --from=build /app/mybin /mybin\`. Build fails with \`pull access denied for build\` or \`stage build not found\`. They assumed the alias was \`build\` but named it \`builder\`. They try \`--from=0\` and it works. They also hit a second case where they reused \`FROM alpine AS builder\` later, shadowing the first \`builder\`, and COPY --from=builder pulled the wrong stage. They learn that --from references either the alias or the numeric stage index, and aliases must be unique across the Dockerfile unless intentional shadowing is desired.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-08T04:39:20.799181+00:00— report_created — created