goreleaser/goreleaser · error

%w: %s

Error message

%w: %s

What it means

goreleaser's docker pipe runs external docker (or podman/buildah) CLI commands and wraps a non-zero exit with the command's combined output. This means a docker command invoked to build/create images or manifests failed; the wrapped string contains docker's own error explaining why.

Source

Thrown at internal/pipe/docker/api.go:64

func runCommand(ctx *context.Context, dir, binary string, args ...string) error {
	/* #nosec */
	cmd := exec.CommandContext(ctx, binary, args...)
	cmd.Dir = dir
	cmd.Env = append(ctx.Env.Strings(), cmd.Environ()...)

	var b bytes.Buffer
	w := gio.Safe(&b)
	cmd.Stderr = redact.Writer(io.MultiWriter(logext.NewWriter(), w), cmd.Env)
	cmd.Stdout = redact.Writer(io.MultiWriter(logext.NewWriter(), w), cmd.Env)

	log.
		WithField("cmd", append([]string{binary}, args[0])).
		WithField("cwd", dir).
		WithField("args", args[1:]).
		Debug("running")
	if err := cmd.Run(); err != nil {
		return fmt.Errorf("%w: %s", err, b.String())
	}
	return nil
}

func runCommandWithOutput(ctx *context.Context, dir, binary string, args ...string) ([]byte, error) {
	/* #nosec */
	cmd := exec.CommandContext(ctx, binary, args...)
	cmd.Dir = dir
	cmd.Env = append(ctx.Env.Strings(), cmd.Environ()...)

	var b bytes.Buffer
	w := gio.Safe(&b)
	cmd.Stderr = redact.Writer(io.MultiWriter(logext.NewWriter(), w), cmd.Env)

	log.
		WithField("cmd", append([]string{binary}, args[0])).
		WithField("cwd", dir).
		WithField("args", args[1:]).

View on GitHub (pinned to f5edd73956)

Solutions

  1. Read the wrapped docker output in the error — it names the exact docker failure
  2. Verify the docker daemon is running (`docker info`) in the release environment
  3. Confirm the Dockerfile path and extra/flags in the docker config are correct
  4. Reproduce the failing command locally (it's logged at debug level: enable --verbose)

Example fix

// CI before
- run: goreleaser release
// after
- run: docker info  # ensure daemon is up
- run: goreleaser release
Defensive patterns

Strategy: validation

Validate before calling

if err := exec.Command("docker", "info").Run(); err != nil {
	return fmt.Errorf("docker daemon unavailable: %w", err)
}
if _, err := os.Stat(dockerfilePath); err != nil {
	return fmt.Errorf("Dockerfile missing: %w", err)
}

Try / catch

if err := release(); err != nil && strings.Contains(err.Error(), ": ") {
	// error is "<docker err>: <combined output>"; log the tail for the docker reason
}

Prevention

When it happens

Trigger: runCommand executes a docker binary (build/create/etc.) and cmd.Run() returns non-zero — e.g. Dockerfile missing, build error, docker daemon not running, binary not found in PATH.

Common situations: Dockerfile path or build flags wrong in config; docker daemon not started on CI runner; unsupported flag for the installed docker version; base image pull failure/network issue; using podman with docker-only flags.

Related errors


AI-assisted analysis of goreleaser/goreleaser@f5edd73956 (2026-09-05). Data as JSON: /api/errors/0273d8199b535d87. Report an issue: GitHub.