Report #9859
[tooling] Shell scripts cannot detect null or missing JSON values because jq always returns exit code 0 even on empty results
Add the \`-e\` \(or \`--exit-status\`\) flag to jq invocations; jq will return exit code 1 if the output is null, false, or empty, enabling proper \`if jq -e '.key' file.json; then ...\` conditionals
Journey Context:
By default, jq outputs 'null' to stdout and returns 0 even when accessing a missing key or filtering to an empty array. This causes scripts to proceed on failure silently. The \`-e\` flag changes exit status semantics to match shell expectations: only truthy JSON values \(non-null, non-false, non-empty arrays/objects\) return 0. This is essential for CI pipelines, health checks, and any automation that branches on JSON content presence.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T09:15:36.612967+00:00— report_created — created