Skip to content
Latchkey

Tekton step "exited with code 1" (TaskRun failed) in CI

The step's container ran to completion but its command returned a non-zero exit code, so Tekton marks the step and the TaskRun Failed. The real error is in that step's log, not in the Tekton status.

What this error means

A TaskRun is Failed with a message like "\"step-build\" exited with code 1". Subsequent steps are skipped and the pod terminates.

Tekton
"step-build" exited with code 1 (image: "golang:1.22"); for logs run: kubectl logs build-run-pod -c step-build -n ci

Common causes

The command in the step genuinely failed

A compile error, a failing test, or a linter returned exit 1. Tekton is faithfully reporting the tool's own failure.

A script error before the real work

A missing file, an unset variable under set -e, or a bad path makes the shell exit 1 before the intended command runs.

How to fix it

Read the step log

  1. The message prints the exact kubectl logs command with the step container name.
  2. Run it to see the tool output that produced exit 1.
  3. Fix the underlying failure (test, build, or script).
Terminal
kubectl logs build-run-pod -c step-build -n ci

Fetch the log with tkn

The Tekton CLI streams step logs for a TaskRun without needing the pod name.

Terminal
tkn taskrun logs build-run -n ci

How to prevent it

  • Reproduce the step command locally with the same image before pushing.
  • Use set -euo pipefail in step scripts so failures are explicit.
  • Keep step images pinned so behavior is reproducible.

Frequently asked questions

What causes ""step ... exited with 1""?
A compile error, a failing test, or a linter returned exit 1. Tekton is faithfully reporting the tool's own failure.
How do I fix "step ... exited with 1"?
Read the step log

Related guides

References

Run this faster and cheaper on Latchkey managed runners - self-healing included. Start free → 30-day trial · No credit card