GoogleContainerTools/skaffold · error

unable to stream build output: %w

Error message

unable to stream build output: %w

What it means

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.

Source

Thrown at pkg/skaffold/docker/image.go:404

	auxCallback := func(msg jsonstream.Message) {
		if msg.Aux == nil {
			return
		}

		var result BuildResult
		if err := json.Unmarshal(*msg.Aux, &result); err != nil {
			log.Entry(ctx).Debug("Unable to parse build output:", err)
			return
		}
		imageID = result.ID
	}

	if err := streamDockerMessages(out, resp.Body, auxCallback); err != nil {
		var jm *jsonstream.Error
		if errors.As(err, &jm) {
			return "", fmt.Errorf("docker build failure: %w", err)
		}
		return "", fmt.Errorf("unable to stream build output: %w", err)
	}

	if imageID == "" {
		// Maybe this version of Docker doesn't return the digest of the image
		// that has been built.
		imageID, err = l.ImageID(ctx, opts.Tag)
		if err != nil {
			return "", fmt.Errorf("getting digest: %w", err)
		}
	}

	return imageID, nil
}

// streamDockerMessages streams formatted json output from the docker daemon
func streamDockerMessages(dst io.Writer, src io.Reader, auxCallback func(jsonstream.Message)) error {
	termFd, isTerm := term.IsTerminal(dst)
	return progress.DisplayJSONMessagesStream(src, dst, termFd, isTerm, auxCallback)

View on GitHub (pinned to a1189de023)

Solutions

  1. Re-run the build; transient stream drops often succeed on retry
  2. Verify the Docker daemon stayed up (check `docker events` / daemon logs)
  3. Avoid proxies/VPNs between client and DOCKER_HOST, or increase their idle timeouts
  4. If reproducible, check daemon logs for restarts/OOM during the build

Example fix

// before
eval $(minikube docker-env)  # flaky tunnel to daemon
// after
export DOCKER_HOST=unix:///var/run/docker.sock  # stable local daemon
Defensive patterns

Strategy: retry

Try / catch

imageID, err := daemon.Build(...)
if err != nil && strings.Contains(err.Error(), "unable to stream build output") {
	// transient stream drop — retry once after confirming daemon health
	time.Sleep(retryDelay)
	imageID, err = daemon.Build(...)
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05). Data as JSON: /api/errors/3d57f4ff31c6951e. Report an issue: GitHub.