Report #94688
[tooling] Shell scripts failing silently when jq returns null or empty results, breaking error handling with set -e
Add the -e \(or --exit-status\) flag to jq so it returns exit code 1 on null/empty/false outputs, enabling proper errexit workflows: \`jq -e '.key' file.json \|\| echo 'missing'\`
Journey Context:
By default jq exits 0 even if the query matches nothing, returning 'null'. This causes \`set -e\` scripts to continue execution with invalid data. The -e flag changes this: it exits 4 for system errors, 1 for null/false/empty outputs, and 0 for valid JSON. This integrates jq into strict bash pipelines without manual output checking, preventing downstream commands from consuming placeholder null values.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T17:31:03.639393+00:00— report_created — created