{"record":{"id":"22dbb6803cfa0b7a","repo":"docker/compose","slug":"failed-to-execute-bake-w","errorCode":null,"errorMessage":"failed to execute bake: %w","messagePattern":"failed to execute bake: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/compose/build_bake.go","lineNumber":370,"sourceCode":"\tvar errMessage []string\n\treader := bufio.NewReader(pipe)\n\n\terr = cmd.Start()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\teg.Go(cmd.Wait)\n\tfor {\n\t\tline, readErr := reader.ReadString('\\n')\n\t\tif readErr != nil {\n\t\t\tif readErr == io.EOF {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif errors.Is(readErr, os.ErrClosed) {\n\t\t\t\tlogrus.Debugf(\"bake stopped\")\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn nil, fmt.Errorf(\"failed to execute bake: %w\", readErr)\n\t\t}\n\t\tdecoder := json.NewDecoder(strings.NewReader(line))\n\t\tvar status client.SolveStatus\n\t\terr := decoder.Decode(&status)\n\t\tif err != nil {\n\t\t\tif strings.HasPrefix(line, \"ERROR: \") {\n\t\t\t\terrMessage = append(errMessage, line[7:])\n\t\t\t} else {\n\t\t\t\terrMessage = append(errMessage, line)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tch <- &status\n\t}\n\tclose(ch) // stop build progress UI\n\n\terr = eg.Wait()\n\tif err != nil {","sourceCodeStart":352,"sourceCodeEnd":388,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/pkg/compose/build_bake.go#L352-L388","documentation":"While streaming buildx bake's progress from its stdout, compose reads line by line; any read error other than io.EOF (normal end) and os.ErrClosed (bake stopped early on purpose) aborts with this error wrapping the read failure. In practice the pipe broke — typically the buildx process died (killed, OOM, plugin crash) or wrote garbage that closed the stream unexpectedly.","triggerScenarios":"docker compose build (bake path) where the buildx plugin process is killed mid-build (OOM killer, manual kill, container runtime stop); buildx crashing on a malformed definition; the stdout pipe being closed from the child side without EOF.","commonSituations":"Memory-constrained CI machines OOM-killing buildx during large builds; upgrading/downgrading the buildx plugin while a build runs; buildx bugs crashing on specific bake targets; dockerd restarts mid-build.","solutions":["Re-run the build — transient process deaths (OOM, daemon restart) usually do not recur","Check dmesg/journal for OOM kills of buildx and free memory or raise limits before retrying","Upgrade the buildx plugin to a stable release (docker buildx version; reinstall via dockerCLI plugin management)","If it reproduces deterministically, capture the failing service/target and run docker buildx bake <target> directly to get buildx's own error"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := composeBuild(); err != nil {\n\tif strings.Contains(err.Error(), \"failed to execute bake\") && isTransient(errors.Unwrap(err)) {\n\t\t// transient pipe/process failure: back off and retry once\n\t\ttime.Sleep(2 * time.Second)\n\t\treturn composeBuild()\n\t}\n\treturn err\n}","preventionTips":["Provision enough memory for buildx in CI (OOM kills are the top cause of dropped bake pipes)","Keep buildx/BuildKit versions current to avoid plugin crashes","Do not restart dockerd or prune the builder during active builds"],"tags":["bake","buildx","process","io"],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}