The pipefail SIGPIPE trap
A verification probe reported a check as failing because the response was large, not because the content was missing. Drag the slider to see the verdict flip on body size alone, with the pattern present the entire time.
Before: piped
curl -s "$ORIGIN$1" | grep -qi -- "$2"
After: captured first
body=$(curl -s "$ORIGIN$1") printf '%s' "$body" | grep -qi -- "$2"
Why it happens
| Step | What actually occurs |
|---|---|
grep -q | Matches, and exits immediately. It does not drain the pipe. |
curl | Still writing. The read end is gone, so it takes SIGPIPE and exits 141. |
set -o pipefail | Reports the pipeline's status as the last non-zero one, so 141 wins over grep's 0. |
if | Sees failure. The probe prints FAIL for a pattern that was present. |
Why it stayed hidden
Every small response passed, because curl finished writing before grep exited. The
bug only appeared on /openapi.json at 42 kB, which made it look like a
property of that one endpoint. The obvious next hypothesis was CDN propagation lag
after a fresh deploy, and re-running later would eventually have "confirmed" it as
soon as anything unrelated changed.
What settled it was running the identical grep by hand and watching it match. Same origin, same bytes, same pattern, different verdict. That leaves the pipeline, not the payload.