{"record":{"id":"7b6490286b46f699","repo":"GoogleContainerTools/skaffold","slug":"starting-command-v-w","errorCode":null,"errorMessage":"starting command %v: %w","messagePattern":"starting command (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/util/cmd.go","lineNumber":103,"sourceCode":"\treturn DefaultExecCommand.RunCmdOutOnce(ctx, cmd)\n}\n\n// Commander is the exec.Cmd implementation of the Command interface\ntype Commander struct {\n\tstore *SyncStore[[]byte]\n}\n\n// RunCmdOut runs an exec.Command and returns the stdout and error.\nfunc (*Commander) RunCmdOut(ctx context.Context, cmd *exec.Cmd) ([]byte, error) {\n\tlog.Entry(ctx).Debugf(\"Running command: %s\", cmd.Args)\n\n\tstdout := bytes.Buffer{}\n\tcmd.Stdout = &stdout\n\tstderr := bytes.Buffer{}\n\tcmd.Stderr = &stderr\n\n\tif err := cmd.Start(); err != nil {\n\t\treturn nil, fmt.Errorf(\"starting command %v: %w\", cmd, err)\n\t}\n\n\tif err := cmd.Wait(); err != nil {\n\t\treturn stdout.Bytes(), &cmdError{\n\t\t\targs:   cmd.Args,\n\t\t\tstdout: stdout.Bytes(),\n\t\t\tstderr: stderr.Bytes(),\n\t\t\tcause:  err,\n\t\t}\n\t}\n\n\tif stderr.Len() > 0 {\n\t\tlog.Entry(ctx).Debugf(\"Command output: [%s], stderr: %s\", stdout.String(), stderr.String())\n\t} else {\n\t\tlog.Entry(ctx).Debugf(\"Command output: [%s]\", stdout.String())\n\t}\n\n\treturn stdout.Bytes(), nil","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/util/cmd.go#L85-L121","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Install the missing binary or correct the command name/path passed to RunCmdOut.","Check PATH in the execution environment (container, CI) vs your shell: echo $PATH.","chmod +x the binary if it lacks the execute bit.","Verify with 'which <cmd>' in the same environment where skaffold runs."],"exampleFix":"// before: assuming tool exists\nout, err := util.RunCmdOut(ctx, nil, \"kustomize\", \"build\", dir)\n// after: resolve or check first\nif _, err := exec.LookPath(\"kustomize\"); err != nil {\n    return nil, fmt.Errorf(\"kustomize not found in PATH; install it or set KUSTOMIZE_PATH\")\n}\nout, err := util.RunCmdOut(ctx, nil, \"kustomize\", \"build\", dir)","handlingStrategy":"validation","validationCode":"if _, err := exec.LookPath(cmdName); err != nil {\n    return fmt.Errorf(\"required tool %q not found in PATH: %w\", cmdName, err)\n}","typeGuard":"func isExecNotFound(err error) bool {\n    var ee *exec.Error\n    return errors.As(err, &ee) && errors.Is(ee, exec.ErrNotFound)\n}","tryCatchPattern":"out, err := util.RunCmdOut(ctx, nil, cmd, args...)\nif err != nil {\n    if strings.Contains(err.Error(), \"executable file not found\") {\n        return fmt.Errorf(\"%s is not installed; see docs for install steps\", cmd)\n    }\n    return err\n}","preventionTips":["Check tool availability with exec.LookPath before invoking external commands","Document and verify required dependencies (docker, kubectl, kustomize) in setup scripts","Ensure PATH is correct inside containers and CI environments","Verify the binary has the execute bit set"],"tags":["exec","process","path","cli"],"backgroundTag":"executable-not-found-in-path","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"}