{"record":{"id":"63b76bfd7d337c9d","repo":"argoproj/argo-workflows","slug":"failed-to-find-name-in-path-w","errorCode":null,"errorMessage":"failed to find name in PATH: %w","messagePattern":"failed to find name in PATH: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/argoexec/commands/emissary.go","lineNumber":211,"sourceCode":"\t\t\t\tif err = os.MkdirAll(depDir, 0o777); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"failed to create dependency dir: %w\", err)\n\t\t\t\t}\n\t\t\t\tdepExitPath := filepath.Join(depDir, \"exitcode\")\n\t\t\t\tcode, waitErr := waitForDependencyExitCode(ctx, depExitPath, signals)\n\t\t\t\tif waitErr != nil {\n\t\t\t\t\treturn waitErr\n\t\t\t\t}\n\t\t\t\texitCode = code\n\t\t\t\tif exitCode != 0 {\n\t\t\t\t\treturn fmt.Errorf(\"dependency %q exited with non-zero code: %d\", y, exitCode)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tname, err = exec.LookPath(name)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to find name in PATH: %w\", err)\n\t}\n\n\tif os.Getenv(\"ARGO_DEBUG_PAUSE_BEFORE\") == \"true\" {\n\t\t// User can create the file: /ctr/NAME_OF_THE_CONTAINER/before\n\t\t// in order to break out of the wait and release the container from\n\t\t// the debugging state.\n\t\tif waitErr := file.WaitForCreate(ctx, varRunArgo+\"/ctr/\"+containerName+\"/before\"); waitErr != nil {\n\t\t\treturn fmt.Errorf(\"failed waiting for debug-pause-before marker: %w\", waitErr)\n\t\t}\n\t}\n\n\tbackoff, err := template.GetRetryStrategy()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get retry strategy: %w\", err)\n\t}\n\n\tcmdErr := retry.OnError(backoff, func(error) bool { return true }, func() error {\n\t\tcommand, closer, err := startCommand(ctx, name, args, template, containerName, includeScriptOutput)","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/cmd/argoexec/commands/emissary.go#L193-L229","documentation":"After waiting for dependencies, runEmissary resolves the container's command name via exec.LookPath. This error means the executable named by the template's `command` (e.g. \"python\", \"/bin/sh\") could not be found in PATH inside the workflow container. The wrapped error is the standard Go exec.ErrNotFound / 'executable file not found in $PATH'.","triggerScenarios":"template.command names a binary that is absent from the image, PATH inside the container does not include the binary's directory, or the command uses a relative name relying on a PATH that differs from the image's default.","commonSituations":"Using a slim/distroless image that lacks `sh` while template.command is [\"sh\", ...]; typo in the command name; switching images (e.g. alpine -> distroless) so a previously present binary disappears; custom containerRuntimeEnv PATH override.","solutions":["Fix template.command to the absolute path of an existing binary in the image (e.g. /bin/sh) or correct the typo","Use an image that actually contains the command, or install it in the image","Verify PATH inside the container (add `env` via debug pause or kubectl exec) and prepend the needed dir","For distroless images, avoid shell wrappers and invoke the binary directly"],"exampleFix":"// before\ncommand: [\"sh\", \"-c\", \"echo hi\"]  # distroless image, no sh\n// after\ncommand: [\"/app/mybin\", \"run\"]","handlingStrategy":"validation","validationCode":"// verify the binary exists in the image before submitting\n// docker run --rm --entrypoint sh <image> -c 'command -v <name>' || echo MISSING\nconst p = process.env.PATH; const found = p.split(':').some(d => require('fs').existsSync(d + '/' + cmdName))","typeGuard":null,"tryCatchPattern":"try { await run() } catch (e) { if (/failed to find name in PATH/.test(e.message)) { throw new Error(`Command not in image PATH: use absolute path or an image containing it (${e.message})`) } throw e }","preventionTips":["Always use absolute paths for template.command (e.g. /bin/sh)","Verify binaries exist in the image in CI before deploying workflows","Don't swap to distroless/slim images without re-checking command names","Document required PATH additions per image"],"tags":["argoexec","exec","path","container-image"],"backgroundTag":"executable-not-found-in-path","analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}