Skip to content
Latchkey

Buildkite dynamic pipeline "exit status 1" in CI

A dynamic pipeline runs a script that prints steps and pipes them to pipeline upload. If that script exits 1, the upload step fails and the build has no further steps.

What this error means

The initial step fails with "exit status 1" from the generator command, often before any "Uploading pipeline" line appears.

buildkite
$ .buildkite/generate.sh | buildkite-agent pipeline upload
./generate.sh: line 12: jq: command not found
error: exit status 1

Common causes

A missing tool in the generator

The script depends on a tool (jq, python, yq) that is not installed on the agent, so it exits before producing valid steps.

The generator errors on bad input

A missing env var or an unexpected repository state makes the generation script fail, and with pipefail that failure surfaces as exit status 1.

How to fix it

Install prerequisites and run the generator standalone

  1. Read the first error line from the generator, not the final "exit status 1".
  2. Install the missing tool on the agent or in a setup step.
  3. Run the generator on its own to confirm it emits valid YAML before piping to upload.
Terminal
.buildkite/generate.sh > /tmp/pipeline.yml
buildkite-agent pipeline upload /tmp/pipeline.yml

Fail fast with strict bash

Use strict mode so the real failing line is obvious and the generator does not upload partial output.

.buildkite/generate.sh
#!/usr/bin/env bash
set -euo pipefail

How to prevent it

  • Bake generator tool dependencies into the agent image.
  • Run the generator standalone in tests so failures surface early.
  • Use set -euo pipefail in upload scripts.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →