Cryptic "Build script returned non-zero exit code: 2" error with no other output

I’m stuck on a cryptic build failure (one failed example deploy) that doesn’t seem to give me any information that would be useful for troubleshooting. Netlify outputs one single line in the deploy log, manually line-wrapped here for readability:

7:05:13 PM: Failed during stage 'building site': Build script returned non-zero
            exit code: 2 (https://ntl.fyi/exit-code-2)

The strangest thing about this failure is that some of the attempts (e.g. this first one) will not load the deploy log at all, and the logs I am able to view show the “Initializing” step as “Skipped” prior to the above one-line error log in the “Building” step. This could be Netlify skipping steps for commits it has already seen, to be fair, but it’s still odd.

Other threads about this exit code show a lot more log output before this type of failure. My own experience with Netlify has also yielded plenty of build failures to troubleshoot, but I’ve likewise always had the full environment setup log and script output to use as a starting point. This is the first time I’ve run across an error that seems to provide NO context for debugging.

I get some extra confusion from the fact that with similar Netlify settings (e.g. same Focal build image), direct builds of the submodule that I’m updating work fine (see e.g. this one from 3 days ago). Something is failing only in the context of trying to integrate the Sphinx content into our base Jekyll site, which the custom build script has been doing successfully for a few years now.

Hey @dgw,

My best guess is the issue you are seeing to related to the deploy log issue reported by other users:

All I can offer is that you use some patience while Netlify rectify this issue (I don’t work for Netlify I just assume they are aware and working on a fix or will do sooner rather than later.)

1 Like

Hi @dig,

Sounds like the best approach is to quit trying to fix my error for a while, wait for the deploy log issue to be resolved, then come back to it.

Thanks for the pointers to other threads! Honestly, I assumed the logs not loading was because of some issue with my browser/extensions, not Netlify itself :smile_cat: since some of the logs did appear to load.

1 Like

Another report

Yet another

Please follow: Netlify Status - Build logs unavailable