Error deploying project; "failed during stage 'preparing repo': exit status 1"

During our build, we’re getting an error: “failed during stage ‘preparing repo’: exit status 1.” Redeploying seems to solve the issue, but the issue occurs quite often. Is there any way to dig deeper into this?

Deploy Id: 5eab11e4cb4d1100076eddd9

hi there, can you post or link us to your build log please?

Here you go:

10:59:00 AM: Build ready to start

10:59:02 AM: build-image version: 2dbd444fcdce00cf06325060a8238d5ae3e86774

10:59:02 AM: build-image tag: v3.3.7

10:59:02 AM: buildbot version: d305548225ac57bb00eb5a596b0b8674e76a4681

10:59:02 AM: Fetching cached dependencies

10:59:02 AM: Starting to download cache of 270.3MB

10:59:07 AM: Finished downloading cache in 4.983018273s

10:59:07 AM: Starting to extract cache

10:59:15 AM: Finished extracting cache in 8.267041272s

10:59:15 AM: Finished fetching cache in 13.380093458s

10:59:15 AM: Starting to prepare the repo for build

10:59:16 AM: Preparing Git Reference refs/heads/master

10:59:18 AM: Failing build: Failed to prepare repo

10:59:18 AM: failed during stage ‘preparing repo’: exit status 1

10:59:18 AM: Finished processing build request in 16.455471279s

thanks. so, this is the real culprit:

10:59:18 AM: Failing build: Failed to prepare repo

it means that there is something Not Right about the connection between Netlify and GitHub (or wherever you are storing your repo).

To solve it 'd probably log in to your git provider, delete/revoke access, and then re-authenticate.
Will you try that and see if that fixes things?

It works occasionally though, if the auth was broken, wouldn’t that cause all builds to fail?

yes, that is a little odd. Any patterns you are noticing between when it breaks and when it works?

No, haven’t really noticed one at all. Sometimes the same build fails and then works when it is re-run. Do you happen to have any internal logs or anything to help pinpoint the problem?

hmm, i’d have to do some checking with the team to be able to say that conclusively.

so basically if you keep retrying, it does eventually work? This isn’t great, obviously, and we want to figure out what is going on, but i’m trying to figure out if you have a workaround in place for the moment.

Yeah it seems to be completely random. Code we push will fail, and then we amend the commit with a different commit message (or do anything else to trigger a re-build), and then it works. Out of the last 15 builds, 7 failed (and 8 succeeded).

ok. well, we’re gonna earmark this and take another look next week when the whole team is back at work, but for now I’m glad you have a workaround.

Awesome thanks! Looking forward to hearing about anything they find.

We addressed this in our helpdesk, but summarizing the findings here for anyone who comes across this error in the future!

We believe this error is due to the size of the repo clashing with the way Netlify handles caches. It looks like a bug we’ve seen a few times that can usually be worked around by retrying a build with cleared cache.

We don’t have a good timeline on a bug fix since we have not managed to track down the root cause yet, but the good news is that after a cache clear the build should work and in many cases it will continue working after that clear. Note that the cache clear does have to be done for every branch and PR since they each have their own cache; clearing on one will not affect others.