In bash, local, declare, export, and readonly are builtins with their own exit status. Writing 'local out=$(failing_command)' assigns whatever the command printed and then reports the status of local, which is 0 unless the assignment itself was invalid. With set -e the script sails past the failure, and an explicit '$?' check afterwards reads the status of local, not of the command.
Confirm it by running 'f() { local x=$(false); echo $?; }; f', which prints 0, versus the same body without local, which prints 1.
The fix is to split declaration from assignment: 'local out; out=$(failing_command)'. The second line is a plain assignment, so it carries the command substitution's status and errexit works. The same applies to 'export VAR=$(...)' at top level. ShellCheck flags this as SC2155, and it is worth enabling in CI because the pattern is easy to reintroduce.