Error 500: unable to find all commit-graph files in Bitbucket DataCenter
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
While viewing the commits page of a repository, an Error 500 screen is shown. Please refer to the screenshot below.
Environment
Tested on Bitbucket Server/Data Center 7.21.x.
This is applicable on higher versions of Bitbucket as well.
Diagnosis
The below error can be seen in the atlassian-bitbucket.log. This generally happens after a power outage/an unexpected restart of the server.
2023-07-24 10:26:27,797 ERROR [http-nio-7990-exec-8] admin *17LM0IBx626x423138x0 1g24rke xx.xx.xx.xx,xx.xx.xx.xx "GET /projects/PRJ/repos/test-repository/commits HTTP/1.1" c.a.s.i.w.HandlerExceptionResolverImpl '/usr/bin/git rev-list --format=%H%x02%P%x02%aN%x02%aE%x02%at%x02%cN%x02%cE%x02%ct%n%B%n%x03END%x04 -51 --no-min-parents --stdin --' exited with code 0 saying: error: commit-graph file is too small
warning: unable to find all commit-graph files
com.atlassian.bitbucket.scm.CommandFailedException: '/usr/bin/git rev-list --format=%H%x02%P%x02%aN%x02%aE%x02%at%x02%cN%x02%cE%x02%ct%n%B%n%x03END%x04 -51 --no-min-parents --stdin --' exited with code 0 saying: error: commit-graph file is too small
warning: unable to find all commit-graph files
Cause
Due to the unexpected restart of the server, the inbuilt commit graph of git becomes corrupted and must be recreated.
Solution
The existing corrupted commit-graph must be removed before recreating.
- Find the repository location on the disk from the Repository Settings page.
- Go to the location and go inside the
objects/info/commit-graph
folder. - Please take a backup of that folder and remove it.
Deleting the old one must be enough to recover the repository. It will just fall back to the code path that doesn't use the commit-graph optimization. Then at some point in the future, Bitbucket will regenerate it when it does repository maintenance.
If the commit graph is still missing after a couple of hours, it can be regenerated from the actual commit data with the command, git commit-graph write --reachable