Report #2865
[bug\_fix] ERROR: failed to solve: target stage "test" could not be found
Define the requested stage in the Dockerfile with \`FROM AS test\` \(or whatever name Bake/\`--target\` expects\), and make sure the name matches exactly. If the stage is only referenced from another stage, ensure the dependency chain reaches it from the final target.
Journey Context:
A team added a \`target "test" \{ target = "test" \}\` block to their \`docker-bake.hcl\` and ran \`docker buildx bake test\`. The build failed immediately with the target-stage error even though the Dockerfile had \`build\` and \`release\` stages. They checked \`docker buildx build --call=targets\` and saw that \`test\` was missing. Adding \`FROM base AS test\` followed by the test runner commands made the Bake target resolvable and the build succeeded.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T14:31:03.919604+00:00— report_created — created