Git "fatal: bad object" when running simultaneous builds

We do CI builds on both branch pushes and pull requests. At times we hit fatal: bad object commithashid at varying stages in the PR build. I am assuming that is because something is being altered in git by the other build. How can I avoid this? Add a git fetch before all steps?

Please link to a build for us to be able to say anything.

Searching online shows that this can happen if you try to make concurrent and conflicting changes from multiple places, or if you didn’t clone the entire repository and are trying to use the missing parts in some less common ways.

https://travis-ci.com/github/Rhumbix/rmbx_django/jobs/364372641

You are running a script you wrote:

$ _ci/script/bdd
> Thu Jul 23 19:45:31 UTC 2020 mSet up the ci environment
fatal: bad object ad13ca7162977dbc39518eb9a9fb36d23a848a29
The command "_ci/script/bdd" exited with 128.

I suggest increasing the verbosity of this script and troubleshoot further. Running a debug build may also help.

There is not much more we can advise you without visibility into the inner workings of this script.

I can’t recreate it in a debug build because it appears to be an issue with parallel builds. I will try adding more output, but it’s git complaining an object it’s trying to get does not exist.