Thanks for the additional information. I’ve not run into many reports of the issue you described. Can you try building your site locally using our build-image? This is described here. More specifically, GitHub - netlify/build-image: This is the build image used for running automated builds is the section that has the steps to do this.
Can you let me know if the error also occurs when testing our build-image locally?