Skip to content
Latchkey

bash "command not found" (PATH) in CI

bash looked through each directory in $PATH and found no matching executable, so it exited 127. Either the tool was never installed on the runner, or it installed somewhere that is not on PATH for this step.

What this error means

A step fails with "line N: <tool>: command not found" and the job ends with "exit code 127". Common with tools installed in a previous step whose PATH change did not persist.

bash
/home/runner/work/_temp/script.sh: line 1: terraform: command not found
Error: Process completed with exit code 127.

Common causes

The tool is not installed on the runner

The binary was never provisioned in this image, or a setup action that installs it was skipped or failed earlier in the job.

The install directory is not on PATH

A tool installed into ~/.local/bin or a custom path is invisible because each GitHub Actions step is a fresh shell; a bare export PATH=... in one step does not carry to the next.

How to fix it

Add the directory to PATH durably

In GitHub Actions, append to $GITHUB_PATH so the change persists into later steps, rather than exporting PATH inline.

.github/workflows/ci.yml
- run: echo "$HOME/.local/bin" >> "$GITHUB_PATH"

Install the tool in the same job

  1. Add a setup step (a setup-* action or a package install) before the step that uses the tool.
  2. Confirm the install location with command -v <tool> and echo "$PATH".
  3. Reference the binary by absolute path if it lives outside PATH.
Terminal
command -v terraform || echo "not on PATH: $PATH"

How to prevent it

  • Use $GITHUB_PATH for PATH changes that must survive across steps.
  • Verify installs with command -v right after installing.
  • Pin setup actions that place binaries on PATH for you.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →