GitLab projects failed their last repository check

Viewed 2625

I have received a gitlab alert mail stating that "One project failed its last repository check". I did check the error in Gitlab admin panel as "Last repository check (just now) failed. See the 'repocheck.log' file for error messages." As suggested in Admin Panel in Gitlab, i have checked the repocheck.log file and the error is as below.

"Could not fsck repository: error: Could not read 0f188244898707e6090498bc03aafd8ac25e776e failed to parse commit 0f188244898707e6090498bc03aafd8ac25e776e from object database for commit-graph error: Could not read 4ab7111f3f8f1083cee8e33ec033c18edfefb0e9"

This happened the same with another repo last week. Even that had similar error message and it is not resolved yet. Tried to clone the same repo in another gitlab instance to recreate the issue but the repo check there seems to be fine. Unable to find proper solution for that. Could any one please help on this.

2 Answers

It seems to be an active issue: https://gitlab.com/gitlab-org/gitaly/-/issues/2359#note_966195929 The issue is a couple of years old, but the note I link to, has updates from today, including info on fixes and workarounds.

In any case: The commit-graph is a relatively new feature and since it is a form of index into packed data, it can be recreated. So the corrupted repo can be easily fixed without loss of data.

It can be reproduced like this:

  1. Visit a commit graph: Project sidebar / Repository / Graph
  2. Delete one of the visible commits by rewriting history:
git checkout <branch>
git reset head~1 
git commit -am "Replace last commit with a new one" 
git push --force
  1. Refresh the page of step 1

Now GitLab will send you "A commit graph at GitLab projects failed their last repository check" when it runs the repository check on a scheduled interval.

It's a bug that admins and maintainers get a warning about this since nothing is wrong really. See the GitLab issues linked by Anders Bandholm for more details.

Related