Skip to content
Latchkey

GitHub Actions "Process completed with exit code 1" in run with set -e

GitHub Actions runs bash steps with set -e -o pipefail by default. Any command that returns non-zero - even one whose failure you intended to tolerate - aborts the step with exit code 1.

What this error means

A run step fails immediately after a command returns non-zero, including commands like grep with no match, which exit 1 by design.

github-actions
+ grep "WARN" build.log
Error: Process completed with exit code 1.

Common causes

set -e aborts on first non-zero

The default bash flags stop the step on any failing command.

Tolerable failures not handled

Commands like grep, diff, or test that legitimately exit non-zero abort the step.

How to fix it

Handle expected non-zero exits

  1. Append || true to commands whose non-zero result is acceptable.
  2. Capture and inspect the exit code explicitly when you need to branch.
  3. Use continue-on-error only when the whole step may legitimately fail.
.github/workflows/ci.yml
- run: |
    if grep -q "WARN" build.log; then
      echo "warnings present"
    fi   # if/grep -q avoids aborting on no-match

How to prevent it

  • Remember bash steps run with errexit and pipefail by default.
  • Guard tolerable failures rather than disabling error handling globally.

Related guides

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