Report #46459
[tooling] Shell scripts cannot detect when jq filter returns null or empty results, causing silent failures in data pipelines
Use \`jq -e '.selector'\` which exits with status 1 if the final output is null or false, enabling standard shell error handling like \`jq -e ... \|\| handle\_missing\` or \`if jq -e ...; then ... fi\`
Journey Context:
By default, jq exits with code 0 even if a query matches nothing \(outputting 'null'\), making it impossible in shell scripts to distinguish between 'the value is null' and 'the value is missing' without parsing output strings or using \`grep -q null\`. The \`-e\` \(or \`--exit-status\`\) flag changes this behavior: it exits 1 if the last output value is false or null, and exits 0 otherwise. This integrates jq into strict shell pipelines \(\`set -e\`\) and enables idiomatic error handling without string comparison, critical for CI/CD pipelines that must fail fast on missing configuration keys.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T08:27:14.019472+00:00— report_created — created