Getting "fatal: loose object <id> is corrupt" errors during GitHub checkout
- Dominant language
- Go
- Stars
- 1.1k
- Forks
- 378
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 74
Description
We're having some intermittent issues with our Buildkite GitHub integration. Some PR builds randomly fail with this:
```
Preparing working directory | 9s
-- | --
| $ cd /var/buildkite/builds/bk-agent-agent-64b47594c8-pqd6l-1/myproject/myproject
| # Host "github.com" already in list of known hosts at "/root/.ssh/known_hosts"
| $ git remote set-url origin git@github.com:myproject/myproject.git
| $ git clean -ffxdq
| # Fetch and checkout pull request head from GitHub
| $ git fetch -v --prune origin refs/pull/17681/head
| error: object file .git/objects/7f/e9776a08bd8a1539f90d26e4f36dc1a1ede382 is empty
| error: object file .git/objects/7f/e9776a08bd8a1539f90d26e4f36dc1a1ede382 is empty
| fatal: loose object 7fe9776a08bd8a1539f90d26e4f36dc1a1ede382 (stored in .git/objects/7f/e9776a08bd8a1539f90d26e4f36dc1a1ede382) is corrupt
| ⚠️ Warning: Checkout failed! exit status 128 (Attempt 1/3 Retrying in 2s)
| # Host "github.com" already in list of known hosts at "/root/.ssh/known_hosts"
| $ git remote set-url origin git@github.com:myproject/myproject.git
| $ git clean -ffxdq
| # Fetch and checkout pull request head from GitHub
| $ git fetch -v --prune origin refs/pull/17681/head
| error: object file .git/objects/7f/e9776a08bd8a1539f90d26e4f36dc1a1ede382 is empty
| error: object file .git/objects/7f/e9776a08bd8a1539f90d26e4f36dc1a1ede382 is empty
| fatal: loose object 7fe9776a08bd8a1539f90d26e4f36dc1a1ede382 (stored in .git/objects/7f/e9776a08bd8a1539f90d26e4f36dc1a1ede382) is corrupt
| ⚠️ Warning: Checkout failed! exit status 128 (Attempt 2/3 Retrying in 2s)
| # Host "github.com" already in list of known hosts at "/root/.ssh/known_hosts"
| $ git remote set-url origin git@github.com:myproject/myproject.git
| $ git clean -ffxdq
| # Fetch and checkout pull request head from GitHub
| $ git fetch -v --prune origin refs/pull/17681/head
| error: object file .git/objects/7f/e9776a08bd8a1539f90d26e4f36dc1a1ede382 is empty
| error: object file .git/objects/7f/e9776a08bd8a1539f90d26e4f36dc1a1ede382 is empty
| fatal: loose object 7fe9776a08bd8a1539f90d26e4f36dc1a1ede382 (stored in .git/objects/7f/e9776a08bd8a1539f90d26e4f36dc1a1ede382) is corrupt
| ⚠️ Warning: Checkout failed! exit status 128 (Attempt 3/3 Retrying in 2s)
| 🚨 Error: exit status 128
```
This happens most commonly if you commit+push to a PR very quickly. The first commit Buildkite gets works, but the following ones fail with this error. However we've seen this happen ever on the first and only commit of a PR.
This failure happens in Buildkite's initial steps before it even gets to running any of our scripts or plugins, so we're not sure how to further debug it. We're on Buildkite Agent 3.22.0.
Could you help us understand what might be going wrong?
Contributor guide
Assessment
This issue has not been assessed yet.