set -eu VAR=$(zcat file.gz | head -n 12)
works fine
set -eu -o pipefail VAR=$(zcat file.gz | head -n 12)
c
Alternatively, you can use
zcat file.gz | awk '(NR<=12)'
The price is that you need to go through all the zcat, no early stop based on the lines you specified.
zcat