Build failing with munmap_chunk(): invalid pointer

I have a site that built fine on Netlify for a long time, and still builds locally with no problems, but after some recent changes the Astro build fails with the error above.

The site is nothing exotic, just a plain ol’ Astro site. The error occurs during Astro’s build phase when, among other things, images are being resized with Sharp, but since there’s no indication of what the error relates to I’m a bit at a loss how to figure out what’s going on.

Any help tracking this down would be much appreciated, thanks!

EDIT: Tried downgrading sharp from 0.33.0 to 0.32.6 in case their recent changes broke something, but the error is exactly the same.

Site name: turnkey-dev.netlify.app

Failed build log: turnkey_failed_build_log_2023_12_08.log · GitHub

Build settings screenshot:

That looks like an error in C, so definitely not something Netlify manages: c - munmap_chunk(): invalid pointer - Stack Overflow.

Sounds like a problem with one of Astro’s dependencies, especially the native binaries.

This is fixed, thanks. Problem was an outdated vite-imagetools dependenency which was causing two versions of the sharp library to be loaded into the process. Worked fine on my local win32 build but caused a segfault on Linux.

The solution was to update the dependency, and force the a uniform version in the monorepo’s root package.json:

	"pnpm": {
		"overrides": {
			"vite-imagetools": "^6.2.7",
			"sharp": "^0.33.0"
		}
	}

Thanks again for looking!