Getting build failure: "Failed to prepare repo"

Hi there,

We’re seeing consistent build failures across all our deployments for these two sites (which both use the same repository):

The build log tells us something went wrong while ‘preparing’ the repository:

11:27:02 AM: Build ready to start
11:27:04 AM: build-image version: 30f629161c0736b1a3ecd8b418e5eeffab5c0faf
11:27:04 AM: build-image tag: v3.3.14
11:27:04 AM: buildbot version: a383ed3390159974f55f285b04457b44cb49efb0
11:27:04 AM: Fetching cached dependencies
11:27:05 AM: Starting to download cache of 533.9MB
11:27:18 AM: Finished downloading cache in 13.331919866s
11:27:18 AM: Starting to extract cache
11:27:45 AM: Finished extracting cache in 27.281222134s
11:27:45 AM: Finished fetching cache in 40.749238123s
11:27:45 AM: Starting to prepare the repo for build
11:27:46 AM: Preparing Git Reference pull/1143/head
11:27:48 AM: Failing build: Failed to prepare repo
11:27:48 AM: Failed during stage 'preparing repo': exit status 1
11:27:48 AM: Finished processing build request in 43.562272405s

It’s likely a problem with the cache, but we can’t really debug what’s going on. Typically:

It’s a monorepo, so a possibility is that artefacts of our internal dependencies (which are written to the root node_modules as a symlink) end up in the cache and cause problems when checked out in the next build.

We’ve tried proposed solutions in these posts, without success:

These are our current build settings:

It’s important to note our setup (using a yarn workspaces managed monorepo) worked perfectly fine with Netlify for a long time and started failing on June 3 with this build: 5ed75ae1bb0bed00070e0791. Since then, the only way for us to get a successful deploy is by retrying without the cache.

Thanks for very precise debugging details - this is the best report I’ve seen all day, Kudos!

I can see from our internal logs that we are failing to correctly handle your cached repo. Clearing the cache at build time as you have discovered is the only workaround I’m aware of that works reliably, though sometimes it will enable future builds to work as well.

I have linked this thread to the bug report so I can follow up with you when we find a fix!

1 Like

@fool any chance for getting a ballpark ETA on this? Is there anything we can do to further debug/help resolve the problem?

We rely on Netlify for our PR reviews and might need to plan for alternatives if this continues to be a problem for us.

Sorry but no timeline at present. I can tell you the team is actively investigating, but we haven’t quite tracked down the root cause yet so it would be presumptuous to say there will be a fix or what the timeline might be.

I promise that I have communicated that this is a problem affecting a growing number of customers to the team.

As of yestrerday, we put additional logging in place to try to track down root cause, so I don’t think we need specific reproduction cases or research, since we now see every time it happens in our internal logs.

1 Like