Skip to content

Debug a failing flow

A flow fails at step 9 of 12. You do not want to run all of it again. Look at the step, then run only that step.

$ truss run ci
...
to run only this step again: truss run ci --step build/package

A failed truss run exits with 1 and prints that line. For a run the daemon started:

$ truss runs --status failed --limit 5
$ truss runs show last
Run 20261117-091500-a1b2c3
Flow nightly
Status failed: nightly failed at test (exit 3)
Trigger schedule
...
STEP STATUS EXIT TOOK TRY TIMELINE
compile succeeded 0 4.2s - |#######...............|
test failed 3 7.1s 2 |.......##############.|
publish stopped - - - |......................|
$ truss logs 20261117-091500-a1b2c3

TRY is the attempt number of a step that was retried. The timeline shows when each step ran, so a slow step, or a step that waited for a free slot, is easy to see.

$ truss flows show ci build/package
Flow ci
Step build/package
Job build
Needs build/compile
Needed by deploy/push
Timeout -
Retries 0
Command
echo "packaging for $REGION/$STAGE"
npm publish --registry "$REGISTRY_URL"
NAME SOURCE STATE VALUE
REGION flow set eu
STAGE step set staging
NPM_TOKEN secret store missing -
REGISTRY_URL host environment not set -
TRUSS_FLOW truss set ci
...

The table lists every variable the step can use and where each value comes from: your files (project, flow, job or step), the secret store, TRUSS, or your shell (host environment). Here two things are wrong before anything runs: the secret NPM_TOKEN is missing, and the command reads $REGISTRY_URL, which nothing sets.

  • A secret shows set or missing, never its value.
  • A name with TOKEN, SECRET, PASSWORD, KEY or AUTH in it shows ***, so a screenshot is safe.
  • TRUSS finds the host environment rows by reading the command for $NAME, ${NAME}, %NAME% and $env:NAME. A script can read variables it does not find. --values also shows their values.
  • truss flows show ci build/package --json prints the same for a script.
$ truss run ci --step build/package --env REGISTRY_URL=https://registry.example.com
debug run: 1 of 3 steps (build/package); the run log is not saved
Option Runs
--step <id> Only that step. The steps it needs are not run; it starts as if they had succeeded.
--step <id> --with-needs That step and every step it needs, directly or not.
--from <id> That step and every step that needs it.
--env NAME=VALUE Sets a variable for the steps that run. Repeat it for more.

A debug run prints its log but does not save it, so the log of your last real run stays. It keeps the step’s own settings (timeout, retries, dir, env, secrets, if). The if of the job of the step you named is not checked, because you named it; other jobs keep theirs, so --from never starts a deploy the flow would skip.

An --env value is visible to other users of the machine in the process list. Put credentials in the secret store with truss secret set; --env refuses a name a step declares as a secret.

$ truss flows graph ci
ci: 3 steps in 3 stages, at most 2 at once
stage 1
[compile]
stage 2
[test] <- compile
stage 3
[publish] <- compile, test

Steps in one stage do not wait for each other, so they can run together up to the flow’s concurrency.

$ truss validate ci

reports a mistake in the file before anything runs: an unknown key, a missing id, a needs that points nowhere.

Troubleshooting lists common symptoms, and where to look.