pipeline-doctor crashes with 'awk: command not found' (exit 127) in its Nix runtime #1

Closed
opened 2026-06-26 09:13:40 +03:00 by oleks · 1 comment
Owner

The pipeline-doctor tool, when run via nix run in a minimal CI environment (e.g. the nixos/nix:2.24.9 image used by Woodpecker), crashes with:

pipeline-doctor.sh: line 256: awk: command not found
pipeline-doctor.sh: line 254: awk: command not found

and exits 127. All contract checks PASS first — the crash is in the script's own later logic that shells out to awk/gawk, which is not on PATH in the Nix-built derivation.

Impact: any repo wiring pipeline-doctor as a CI step sees the whole workflow abort (downstream build/publish skipped) unless that step is marked failure: ignore. Observed in oleks/gitea-mcp pipeline #16 (build + publish skipped); worked around locally in that repo's .woodpecker.yaml by making the non-blocking doctor step tolerant — but the root cause is here.

Root cause: the pipeline-doctor Nix derivation/runtime does not include gawk (or whatever provides awk) in its PATH/buildInputs.

Fix: add gawk to the wrapper's runtime inputs (e.g. makeWrapper ... --prefix PATH : ${lib.makeBinPath [ gawk ]} or add it to buildInputs), or replace the awk calls with shell/jq equivalents already available.

Repro: run nix run git+https://git.oleks.space/oleks/parity-lib#pipeline-doctor against any repo inside the nixos/nix image (no system awk).

The `pipeline-doctor` tool, when run via `nix run` in a minimal CI environment (e.g. the `nixos/nix:2.24.9` image used by Woodpecker), crashes with: ``` pipeline-doctor.sh: line 256: awk: command not found pipeline-doctor.sh: line 254: awk: command not found ``` and exits **127**. All contract checks PASS first — the crash is in the script's own later logic that shells out to `awk`/`gawk`, which is not on PATH in the Nix-built derivation. **Impact:** any repo wiring pipeline-doctor as a CI step sees the whole workflow abort (downstream build/publish skipped) unless that step is marked `failure: ignore`. Observed in `oleks/gitea-mcp` pipeline #16 (build + publish skipped); worked around locally in that repo's `.woodpecker.yaml` by making the non-blocking doctor step tolerant — but the root cause is here. **Root cause:** the pipeline-doctor Nix derivation/runtime does not include `gawk` (or whatever provides `awk`) in its `PATH`/`buildInputs`. **Fix:** add `gawk` to the wrapper's runtime inputs (e.g. `makeWrapper ... --prefix PATH : ${lib.makeBinPath [ gawk ]}` or add it to `buildInputs`), or replace the `awk` calls with shell/`jq` equivalents already available. **Repro:** run `nix run git+https://git.oleks.space/oleks/parity-lib#pipeline-doctor` against any repo inside the `nixos/nix` image (no system awk).
Author
Owner

Fixed in 58f090d — added gawk to pipeline-doctor's runtimeInputs. writeShellApplication restricts PATH to its declared inputs, which omitted gawk, so the token-leak check's awk-based line-continuation flattening crashed with awk: command not found (exit 127) in minimal Nix runtimes.

Verified: nix build .#pipeline-doctor then running it against a repo → 9 passed, 0 failed, exit 0 (no awk error).

Note: oleks/gitea-mcp still keeps failure: ignore on its doctor step as defense-in-depth for a read-only non-blocking lint; that can stay or be reverted now that the root cause is gone.

Fixed in 58f090d — added `gawk` to pipeline-doctor's `runtimeInputs`. `writeShellApplication` restricts PATH to its declared inputs, which omitted gawk, so the token-leak check's awk-based line-continuation flattening crashed with `awk: command not found` (exit 127) in minimal Nix runtimes. Verified: `nix build .#pipeline-doctor` then running it against a repo → 9 passed, 0 failed, exit 0 (no awk error). Note: `oleks/gitea-mcp` still keeps `failure: ignore` on its doctor step as defense-in-depth for a read-only non-blocking lint; that can stay or be reverted now that the root cause is gone.
oleks closed this issue 2026-06-26 09:19:14 +03:00
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: oleks/parity-lib#1