Skip to content
Latchkey

Buildkite "command exited with status 1" in CI

Buildkite fails a step when its command returns any non-zero exit code. Status 1 is the generic failure code: the real reason is in the command output above this line.

What this error means

A step ends with "The command exited with status 1" and the build is marked failed. The output above shows the actual command that failed.

buildkite
$ npm test
...
Tests: 1 failed, 42 passed
The command exited with status 1

Common causes

The underlying command genuinely failed

A test failure, a lint error, or a build error returned exit 1, and Buildkite propagated it as a step failure.

A chained command hides which one failed

Multiple commands joined with && or a shell without pipefail can report status 1 without making the failing command obvious.

How to fix it

Read the output and reproduce locally

  1. Scroll to the command directly above the "status 1" line.
  2. Reproduce that exact command locally to see the real error.
  3. Fix the underlying failure, then re-run the step.

Make the failing command explicit

Split combined commands into separate step commands and enable pipefail so the exact failure is attributable.

pipeline.yml
steps:
  - label: "test"
    commands:
      - "set -euo pipefail"
      - "npm ci"
      - "npm test"

How to prevent it

  • Keep one logical action per command so failures are attributable.
  • Enable set -euo pipefail in multi-command steps.
  • Surface test/lint reports as annotations for faster triage.

Frequently asked questions

What causes ""command exited with status 1""?
A test failure, a lint error, or a build error returned exit 1, and Buildkite propagated it as a step failure.
How do I fix "command exited with status 1"?
Read the output and reproduce locally

Related guides

References

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