{"record":{"id":"793c127166ac9f6e","repo":"docker/compose","slug":"build-result-not-found-in-bake-metadata-for-servic","errorCode":null,"errorMessage":"build result not found in Bake metadata for service %s","messagePattern":"build result not found in Bake metadata for service (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/compose/build_bake.go","lineNumber":418,"sourceCode":"\tvar md bakeMetadata\n\terr = json.Unmarshal(b, &md)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Bake reports the top-level attested image/index digest, which changes on\n\t// every build when provenance attestations are enabled — even for a fully\n\t// cached build (see https://github.com/docker/compose/issues/13636). For\n\t// images loaded into the local engine (the common non-push case), resolve\n\t// the canonical content digest — with the service's pinned platform when\n\t// set — so unchanged rebuilds don't recreate containers.\n\tresults := map[string]string{}\n\tfor name, service := range serviceToBeBuild {\n\t\timage := expectedImages[name]\n\t\ttarget := targets[name]\n\t\tbuilt, ok := md[target]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"build result not found in Bake metadata for service %s\", name)\n\t\t}\n\t\tresults[image] = s.canonicalBuiltDigest(ctx, image, service.Platform, built.Digest)\n\t\ts.events.On(builtEvent(image))\n\t}\n\n\treturn results, nil\n}\n\nfunc (s *composeService) getBuildxPlugin() (*manager.Plugin, error) {\n\tbuildx, err := manager.GetPlugin(\"buildx\", s.dockerCli, &cobra.Command{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif buildx.Err != nil {\n\t\treturn nil, buildx.Err\n\t}\n","sourceCodeStart":400,"sourceCodeEnd":436,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/pkg/compose/build_bake.go#L400-L436","documentation":"After a successful bake, compose reads the JSON metadata file written by buildx to map each built target to its image digest. If the metadata map has no entry for the target corresponding to a requested service, the build result cannot be attributed and this error is returned naming the service. It indicates the bake run did not actually produce (or record) a result for that target — typically target-name mismatches or buildx output configuration (e.g. no exporter) that skips metadata entries.","triggerScenarios":"Building with bake where the service's build target resolves to a name absent from the metadata file; custom bakes or COMPOSE_BAKE overrides that rename or merge targets; buildx versions writing a different metadata schema; targets configured with cache-only or no output so no result is recorded.","commonSituations":"Using a custom docker-bake.hcl or bake overrides alongside compose; downgrading/patching buildx so metadata keys change; services whose build produces no loadable image; compose/buildx version skew.","solutions":["Upgrade docker compose and buildx together to versions known compatible (buildx >= 0.17.0 for this compose)","Remove custom bake overrides (COMPOSE_BAKE env, docker-bake.hcl) that rename or drop the service's target","Inspect the metadata file left by buildx (set --metadata-file in a direct docker buildx bake run) to see which target names are recorded and align names","Fall back to the classic builder (COMPOSE_BAKE=false) to unblock while diagnosing"],"exampleFix":"# before\n$ COMPOSE_BAKE=true docker compose build web   # build result not found in Bake metadata for service web\n# after — remove conflicting override and retry\n$ unset OVERRIDE_BAKE_FLAGS\n$ docker compose build web\n# or bypass bake while diagnosing\n$ COMPOSE_BAKE=false docker compose build web\n","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := composeBuild(); err != nil {\n\tif strings.Contains(err.Error(), \"build result not found in Bake metadata\") {\n\t\t// metadata/target mismatch: fall back to classic build, then align versions\n\t\tos.Setenv(\"COMPOSE_BAKE\", \"false\")\n\t\treturn composeBuild()\n\t}\n\treturn err\n}","preventionTips":["Upgrade docker compose and buildx together; pin both in CI images","Avoid custom docker-bake.hcl overrides that rename compose-generated targets","Ensure every built target has an output exporter (image load or push) so metadata records it"],"tags":["bake","metadata","buildx","version-skew"],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}