Error with install script: URL using bad/illegal format or missing URL

On my CI process, I’m running curl -L https://fly.io/install.sh | sh but sometimes, randomly I get this error:

curl: (3) URL using bad/illegal format or missing URL

Any ideas why?