non-zero exit code: 2

what this Netlify error means

How it shows up

Build script returned non-zero exit code: 2

What it means

The build command failed, so Netlify stopped and did not deploy. The exit code is only a summary; the actual reason is printed in the build log above it.

The usual cause in an AI-built app

One common cause in AI-built apps is an import whose letter case does not match the file name, such as ./header for Header.tsx. It works on Mac or Windows, but Netlify builds on a case-sensitive file system and cannot find the file.

Check this first

Scroll up in the Netlify build log from the exit code line and read the first error message printed before it.

More Netlify codes