Build couldn't download prebuilt node image and tried building it from the source

In a recent build, after the download of the Node binaries failed, the machine appears to have downloaded the Node source code instead and started building it:

15:37:49.080	Success: Finished cloning repository files
15:37:49.697	Installing dependencies
15:37:49.705	Python version set to 2.7
15:37:51.468	Attempting node version '20.10.0' from .nvmrc
15:37:52.393	Downloading and installing node v20.10.0...
15:37:52.733	Downloading https://nodejs.org/dist/v20.10.0/node-v20.10.0-linux-x64.tar.xz...
15:45:40.508	curl: (18) transfer closed with 23340440 bytes remaining to read
15:45:40.521	Binary download from https://nodejs.org/dist/v20.10.0/node-v20.10.0-linux-x64.tar.xz failed, trying source.
15:45:40.527	grep: /opt/buildhome/.nvm/.cache/bin/node-v20.10.0-linux-x64/node-v20.10.0-linux-x64.tar.xz: No such file or directory
15:45:40.528	Provided file to checksum does not exist.
15:45:40.540	Binary download failed, trying source.
15:45:40.559	Detected that you have 8 CPU core(s)
15:45:40.559	Running with 7 threads to speed up the build
15:45:40.737	clang: error while loading shared libraries: libz3.so.4: cannot open shared object file: No such file or directory
15:45:41.013	Downloading https://nodejs.org/dist/v20.10.0/node-v20.10.0.tar.xz...
15:45:41.816	Computing checksum with sha256sum
15:45:42.036	Checksums matched!
15:45:45.763	$>./configure --prefix=/opt/buildhome/.nvm/versions/node/v20.10.0 <
15:45:49.010	Node.js configure: Found Python 3.8.10...
15:45:49.010	WARNING: C++ compiler (CXX=g++, 9.4.0) too old, need g++ 10.1.0 or clang++ 8.0.0
15:45:49.010	WARNING: warnings were emitted in the configure phase
15:45:49.010	INFO: configure completed successfully
15:45:49.376	make -C out BUILDTYPE=Release V=0
15:45:49.540	  touch /opt/buildhome/.nvm/.cache/src/node-v20.10.0/files/out/Release/obj.target/deps/googletest/gtest_prod.stamp
15:45:49.541	  g++ -o /opt/buildhome/.nvm/.cache/src/node-v20.10.0/files/out/Release/obj.target/simdutf/deps/simdutf/simdutf.o ../deps/simdutf/simdutf.cpp '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-DNODE_OPENSSL_CONF_NAME=nodejs_conf' '-DNODE_OPENSSL_HAS_QUIC' '-DICU_NO_USER_DATA_OVERRIDE' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' -I../deps/simdutf  -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++17 -MMD -MF /opt/buildhome/.nvm/.cache/src/node-v20.10.0/files/out/Release/.deps//opt/buildhome/.nvm/.cache/src/node-v20.10.0/files/out/Release/obj.target/simdutf/deps/simdutf/simdutf.o.d.raw   -c
15:45:49.543	  cc -o /opt/buildhome/.nvm/.cache/src/node-v20.10.0/files/out/Release/obj.target/libuv/deps/uv/src/fs-poll.o ../deps/uv/src/fs-poll.c '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-DNODE_OPENSSL_CONF_NAME=nodejs_conf' '-DNODE_OPENSSL_HAS_QUIC' '-DICU_NO_USER_DATA_OVERRIDE' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D_GNU_SOURCE' -I../deps/uv/include -I../deps/uv/src  -pthread -Wall -Wextra -Wno-unused-parameter -fvisibility=hidden -g --std=gnu89 -Wall -Wextra -Wno-unused-parameter -Wstrict-prototypes -fno-strict-aliasing -m64 -O3 -fno-omit-frame-pointer  -MMD -MF /opt/buildhome/.nvm/.cache/src/node-v20.10.0/files/out/Release/.deps//opt/buildhome/.nvm/.cache/src/node-v20.10.0/files/out/Release/obj.target/libuv/deps/uv/src/fs-poll.o.d.raw   -c

We then cancelled the build after more than 20 minutes, usually it takes less than two. We’d like to flag this as a bug:

Actual behaviour: Upon failing to download the node binaries, gets stuck for several minutes and then switches over to downloading the node sources and attempting to build it.

Expected behaviour: Upon failing to download the node binaries, it retries or fails the build.