{"record":{"id":"3d57f4ff31c6951e","repo":"GoogleContainerTools/skaffold","slug":"unable-to-stream-build-output-w","errorCode":null,"errorMessage":"unable to stream build output: %w","messagePattern":"unable to stream build output: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/docker/image.go","lineNumber":404,"sourceCode":"\tauxCallback := func(msg jsonstream.Message) {\n\t\tif msg.Aux == nil {\n\t\t\treturn\n\t\t}\n\n\t\tvar result BuildResult\n\t\tif err := json.Unmarshal(*msg.Aux, &result); err != nil {\n\t\t\tlog.Entry(ctx).Debug(\"Unable to parse build output:\", err)\n\t\t\treturn\n\t\t}\n\t\timageID = result.ID\n\t}\n\n\tif err := streamDockerMessages(out, resp.Body, auxCallback); err != nil {\n\t\tvar jm *jsonstream.Error\n\t\tif errors.As(err, &jm) {\n\t\t\treturn \"\", fmt.Errorf(\"docker build failure: %w\", err)\n\t\t}\n\t\treturn \"\", fmt.Errorf(\"unable to stream build output: %w\", err)\n\t}\n\n\tif imageID == \"\" {\n\t\t// Maybe this version of Docker doesn't return the digest of the image\n\t\t// that has been built.\n\t\timageID, err = l.ImageID(ctx, opts.Tag)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"getting digest: %w\", err)\n\t\t}\n\t}\n\n\treturn imageID, nil\n}\n\n// streamDockerMessages streams formatted json output from the docker daemon\nfunc streamDockerMessages(dst io.Writer, src io.Reader, auxCallback func(jsonstream.Message)) error {\n\ttermFd, isTerm := term.IsTerminal(dst)\n\treturn progress.DisplayJSONMessagesStream(src, dst, termFd, isTerm, auxCallback)","sourceCodeStart":386,"sourceCodeEnd":422,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/docker/image.go#L386-L422","documentation":"streamDockerMessages returned an error that is NOT a jsonstream build error — i.e. reading the daemon's response stream broke (connection reset, unexpected EOF, malformed stream). Build wraps it as `unable to stream build output` to signal a transport/streaming problem rather than a Dockerfile failure.","triggerScenarios":"streamDockerMessages fails while copying resp.Body to out and the error does not decode to *jsonstream.Error — dropped connection to the daemon mid-build, daemon restart during build, or a non-JSON/unexpected payload on the stream.","commonSituations":"Laptop sleeps or network drops during a remote DOCKER_HOST build; Docker daemon OOM-killed or restarted mid-build; very long builds hitting an idle timeout through a proxy/tunnel.","solutions":["Re-run the build; transient stream drops often succeed on retry","Verify the Docker daemon stayed up (check `docker events` / daemon logs)","Avoid proxies/VPNs between client and DOCKER_HOST, or increase their idle timeouts","If reproducible, check daemon logs for restarts/OOM during the build"],"exampleFix":"// before\neval $(minikube docker-env)  # flaky tunnel to daemon\n// after\nexport DOCKER_HOST=unix:///var/run/docker.sock  # stable local daemon","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"imageID, err := daemon.Build(...)\nif err != nil && strings.Contains(err.Error(), \"unable to stream build output\") {\n\t// transient stream drop — retry once after confirming daemon health\n\ttime.Sleep(retryDelay)\n\timageID, err = daemon.Build(...)\n}","preventionTips":["Avoid unreliable network paths (VPN/proxy) to remote DOCKER_HOSTs","Keep daemons resourced to avoid OOM restarts mid-build","Monitor daemon uptime during long builds"],"tags":["docker","streaming","network"],"backgroundTag":"docker-stream-read-failed","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}