Build fails at repository cloning step without helpful error message

I have a Jekyll site hosted on Netlify, that uses Netlify CMS. At some point changes from Netlify CMS started to result in failed builds, with a very short log that didn’t do much to help track down the issue:

4:09:59 PM: Build ready to start
4:10:02 PM: build-image version: 4c0... (focal)
4:10:02 PM: build-image tag: v4.15.0
4:10:02 PM: buildbot version: 9ef...
4:10:02 PM: Fetching cached dependencies
4:10:02 PM: Failed to fetch cache, continuing with build
4:10:02 PM: Starting to prepare the repo for build
4:10:04 PM: No cached dependencies found. Cloning fresh repo
4:10:04 PM: git clone
4:10:06 PM: Error cloning repository:
4:10:06 PM: Creating deploy upload records
4:10:07 PM: Failing build: Failed to prepare repo
4:10:07 PM: Failed during stage 'preparing repo': exit status 128
4:10:07 PM: Finished processing build request in 4.665340242s

There had been no changes in the codebase, except for the content created via Netlify CMS, which I found quite weird. After some poking around, I was able to track down the issue: overly long file name present in the repository.

One post created from Netlify CMS had a long title. Because it’s Jekyll, the generated file name was even longer as the format is date + title. Netlify seems to have problems with filename length after a certain point, but I was not able to find any documentation on this, and as you see above, the build log didn’t tell me about it either.

Solution: find the file whose creation produced the first failed build, and shorten its name

Posting this here to help someone facing the same issue.

Also maybe the Netlify team can take a look and see if something can be done about this.

Thank you for the solution. Could you please share the deploy ID, or deploy link or site name, so we can check what this looks like in our logs? We can then try to improve the logging accordingly.

Sure, this is the build ID: