Applying '.foo' to a value that is not an object or null raises 'Cannot index number with "foo"' and jq exits with status 5, abandoning the remaining inputs. Applying '.[]' to null raises 'Cannot iterate over null'. In a pipeline processing many records, one malformed record therefore kills the whole run partway through, leaving partial output already written to stdout.
The optional operator suppresses errors for one expression: '.foo?' produces nothing instead of failing, and '.[]?' iterates only when the value is iterable. 'try EXPR catch "message"' is the general form and lets you emit a placeholder. Note that '.foo' on null is not an error at all; it yields null, which is why the failure only appears once a field holds an unexpected scalar.
For bulk processing, guard at the top with 'select(type == "object")' or normalise with 'if type == "array" then . else [.] end'. If partial output is unacceptable, buffer with '-s' or write to a temporary file and move it into place only after jq exits zero.