GoogleContainerTools/skaffold · error

starting command

Error message

starting command %v: %w

What it means

RunCmdOut starts an external command with cmd.Start(). This error means the process could not even be spawned — before any output is captured — e.g. because the executable does not exist or lacks execute permission. The command itself and the OS error are wrapped for diagnosis.

Solutions

  1. Install the missing binary or correct the command name/path passed to RunCmdOut.
  2. Check PATH in the execution environment (container, CI) vs your shell: echo $PATH.
  3. chmod +x the binary if it lacks the execute bit.
  4. Verify with 'which <cmd>' in the same environment where skaffold runs.

Example fix

// before: assuming tool exists
out, err := util.RunCmdOut(ctx, nil, "kustomize", "build", dir)
// after: resolve or check first
if _, err := exec.LookPath("kustomize"); err != nil {
    return nil, fmt.Errorf("kustomize not found in PATH; install it or set KUSTOMIZE_PATH")
}
out, err := util.RunCmdOut(ctx, nil, "kustomize", "build", dir)
Defensive patterns

Strategy: validation

Validate before calling

if _, err := exec.LookPath(cmdName); err != nil {
    return fmt.Errorf("required tool %q not found in PATH: %w", cmdName, err)
}

Type guard

func isExecNotFound(err error) bool {
    var ee *exec.Error
    return errors.As(err, &ee) && errors.Is(ee, exec.ErrNotFound)
}

Try / catch

out, err := util.RunCmdOut(ctx, nil, cmd, args...)
if err != nil {
    if strings.Contains(err.Error(), "executable file not found") {
        return fmt.Errorf("%s is not installed; see docs for install steps", cmd)
    }
    return err
}

Prevention

When it happens

Trigger: cmd.Start() returns an error: binary not found in PATH (exec: "foo": executable file not found in $PATH), no execute bit, ENOEXEC on a bad shebang, or resource limits (fork failures).

Common situations: Required tool (docker, kubectl, kustomize, helm) not installed; tool installed under a different name/path; PATH differs between shell and the process invoking skaffold; running in a minimal container image without the binary.

Related errors


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

Appendix: source

Thrown at pkg/skaffold/util/cmd.go:103

	return DefaultExecCommand.RunCmdOutOnce(ctx, cmd)
}

// Commander is the exec.Cmd implementation of the Command interface
type Commander struct {
	store *SyncStore[[]byte]
}

// RunCmdOut runs an exec.Command and returns the stdout and error.
func (*Commander) RunCmdOut(ctx context.Context, cmd *exec.Cmd) ([]byte, error) {
	log.Entry(ctx).Debugf("Running command: %s", cmd.Args)

	stdout := bytes.Buffer{}
	cmd.Stdout = &stdout
	stderr := bytes.Buffer{}
	cmd.Stderr = &stderr

	if err := cmd.Start(); err != nil {
		return nil, fmt.Errorf("starting command %v: %w", cmd, err)
	}

	if err := cmd.Wait(); err != nil {
		return stdout.Bytes(), &cmdError{
			args:   cmd.Args,
			stdout: stdout.Bytes(),
			stderr: stderr.Bytes(),
			cause:  err,
		}
	}

	if stderr.Len() > 0 {
		log.Entry(ctx).Debugf("Command output: [%s], stderr: %s", stdout.String(), stderr.String())
	} else {
		log.Entry(ctx).Debugf("Command output: [%s]", stdout.String())
	}

	return stdout.Bytes(), nil

View on GitHub (pinned to a1189de023)