argoproj/argo-workflows · error

failed to find name in PATH: %w

Error message

failed to find name in PATH: %w

What it means

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'.

Source

Thrown at cmd/argoexec/commands/emissary.go:211

				if err = os.MkdirAll(depDir, 0o777); err != nil {
					return fmt.Errorf("failed to create dependency dir: %w", err)
				}
				depExitPath := filepath.Join(depDir, "exitcode")
				code, waitErr := waitForDependencyExitCode(ctx, depExitPath, signals)
				if waitErr != nil {
					return waitErr
				}
				exitCode = code
				if exitCode != 0 {
					return fmt.Errorf("dependency %q exited with non-zero code: %d", y, exitCode)
				}
			}
		}
	}

	name, err = exec.LookPath(name)
	if err != nil {
		return fmt.Errorf("failed to find name in PATH: %w", err)
	}

	if os.Getenv("ARGO_DEBUG_PAUSE_BEFORE") == "true" {
		// User can create the file: /ctr/NAME_OF_THE_CONTAINER/before
		// in order to break out of the wait and release the container from
		// the debugging state.
		if waitErr := file.WaitForCreate(ctx, varRunArgo+"/ctr/"+containerName+"/before"); waitErr != nil {
			return fmt.Errorf("failed waiting for debug-pause-before marker: %w", waitErr)
		}
	}

	backoff, err := template.GetRetryStrategy()
	if err != nil {
		return fmt.Errorf("failed to get retry strategy: %w", err)
	}

	cmdErr := retry.OnError(backoff, func(error) bool { return true }, func() error {
		command, closer, err := startCommand(ctx, name, args, template, containerName, includeScriptOutput)

View on GitHub (pinned to 35bff19146)

Solutions

  1. Fix template.command to the absolute path of an existing binary in the image (e.g. /bin/sh) or correct the typo
  2. Use an image that actually contains the command, or install it in the image
  3. Verify PATH inside the container (add `env` via debug pause or kubectl exec) and prepend the needed dir
  4. For distroless images, avoid shell wrappers and invoke the binary directly

Example fix

// before
command: ["sh", "-c", "echo hi"]  # distroless image, no sh
// after
command: ["/app/mybin", "run"]
Defensive patterns

Strategy: validation

Validate before calling

// verify the binary exists in the image before submitting
// docker run --rm --entrypoint sh <image> -c 'command -v <name>' || echo MISSING
const p = process.env.PATH; const found = p.split(':').some(d => require('fs').existsSync(d + '/' + cmdName))

Try / catch

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 }

Prevention

When it happens

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

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

Related errors


AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03). Data as JSON: /api/errors/63b76bfd7d337c9d. Report an issue: GitHub.