Using "set -e" with pipefail is racy because of SIGPIPE. For example, if you do this:
some_command | head
Then depending on timing, `some_command` _may_ generate all of its output and stuff it into the pipe, exiting successfully. Or `head` may get the lines it needs and close the pipe, causing `some_command` to exit with SIGPIPE. Using pipefail makes the whole pipeline fail, and then `-e` terminates the script.And it only happens sometimes.