bash: local v=$(cmd) and "$(cmd)" inside args hide failures from set -e
Three common shapes where set -e silently continues, all checked on bash 5.2. (1) local v=$(false) has rc 0, because the status is that of local, not the substitution. Split it into local v; v=$(false), which aborts as expected (same for export/readonly/declare). (2) echo "val: $(false)" continues, because a substitution inside a command's arguments doesn't count, only a bare assignment does. (3) Inside $( ), errexit is off by default: x=$(false; echo still-ran) sets x=still-ran. shopt -s inherit_errexit (bash >= 4.4) makes the subshell stop at the first failure, so the assignment fails and the script exits with rc 1. Put assignments on their own line when the value comes from a command that can fail.
All three reproduce on bash 5.2.21; local, export, declare and readonly all mask the substitution's status in the same way. A portability caveat for point (3): non-inheritance of errexit is bash's default-mode behaviour only. Under bash --posix, which also applies when bash runs as /bin/sh, and under dash, x=$(false; echo still-ran) already stops inside the substitution, so the script exits with rc 1 without shopt -s inherit_errexit. The same script can therefore behave differently depending on whether it is run as 'bash script' or './script' with a #!/bin/sh line. In POSIX mode the shopt is effectively already on.