500 error when performing a Git operation against a Bitbucket Server repository
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
Problem
Performing any Git operation against a Bitbucket Server repository fails, and a 500 error message is returned.
The following appears in the atlassian-bitbucket.log:
ERROR [http-nio-7990-exec-4] @BZM30Fx890x69x0 127.0.0.0 "GET /mvc/error500 HTTP/1.1" c.a.s.i.web.ErrorPageController There was an unhandled exception loading [/scm/<project_key>/<repository_slug>.git/info/refs]
java.lang.IllegalArgumentException: [/var/atlassian/application-data/bitbucket/shared/data/repositories/<repositoryId>] does not exist
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145) ~[guava-18.0.jar:na]
Diagnosis
Diagnostic Steps
- Browse to the location specified in the log files (
/var/atlassian/application-data/bitbucket/shared/data/repositories/<repositoryId>
) and check if the folder exist and is not empty Alternatively, browse to the
<BITBUCKET_URL>/projects/<project_key>/repos/<repository_slug>/settings
page and click on "Approximate size". The "Location on disk" on the user interface shows the same path reported in the log files.
The folder is expected to be empty or missing, and the "Approximate size" check returns 0KB.
Cause
The repository folder has been removed or emptied.
Resolution
Restore a previous backup of Bitbucket Server by using the Bitbucket Server Backup Client.
A complete restore is the optimal solution. In case you don't have a backup available, you could restore the single repository folder from an existing partial backup.