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.
1. Find out what failed
Section titled “1. Find out what failed”$ truss run ci...to run only this step again: truss run ci --step build/packageA 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 lastRun 20261117-091500-a1b2c3Flow nightlyStatus failed: nightly failed at test (exit 3)Trigger schedule...STEP STATUS EXIT TOOK TRY TIMELINEcompile succeeded 0 4.2s - |#######...............|test failed 3 7.1s 2 |.......##############.|publish stopped - - - |......................|
$ truss logs 20261117-091500-a1b2c3TRY 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.
2. Look at the step
Section titled “2. Look at the step”$ truss flows show ci build/packageFlow ciStep build/packageJob buildNeeds build/compileNeeded by deploy/pushTimeout -Retries 0Command echo "packaging for $REGION/$STAGE" npm publish --registry "$REGISTRY_URL"
NAME SOURCE STATE VALUEREGION flow set euSTAGE step set stagingNPM_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
setormissing, never its value. - A name with
TOKEN,SECRET,PASSWORD,KEYorAUTHin it shows***, so a screenshot is safe. - TRUSS finds the
host environmentrows by reading the command for$NAME,${NAME},%NAME%and$env:NAME. A script can read variables it does not find.--valuesalso shows their values. truss flows show ci build/package --jsonprints the same for a script.
3. Run only that step
Section titled “3. Run only that step”$ truss run ci --step build/package --env REGISTRY_URL=https://registry.example.comdebug 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.
4. See the order of steps
Section titled “4. See the order of steps”$ truss flows graph cici: 3 steps in 3 stages, at most 2 at once
stage 1 [compile]
stage 2 [test] <- compile
stage 3 [publish] <- compile, testSteps in one stage do not wait for each other, so they can run together up to the flow’s
concurrency.
5. Check the file
Section titled “5. Check the file”$ truss validate cireports a mistake in the file before anything runs: an unknown key, a missing id, a needs that
points nowhere.
Still stuck?
Section titled “Still stuck?”Troubleshooting lists common symptoms, and where to look.