Upon browsing a specific repo, an "500 exited with code 0" error occurs in Bitbucket Server

Still need help?

The Atlassian Community is here for you.

Ask the community


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

Upon navigating to a repository, the following error is shown in the browser:


Diagnosis

The logs show:

2022-06-14 15:21:20,450 ERROR [http-nio-7990-exec-12] username *6NVJE6x1102x69188x9 15rn1m9 10.10.10.10,10.20.30.40 "GET /projects/PROJECT/repos/test_repo/browse HTTP/1.1" c.a.s.i.w.HandlerExceptionResolverImpl '/usr/bin/git ls-tree -z -l refs/heads/master: --' exited with code 0
com.atlassian.bitbucket.scm.CommandFailedException: '/usr/bin/git ls-tree -z -l refs/heads/master: --' exited with code 0
...
    Suppressed: com.atlassian.bitbucket.scm.CommandFailedException: '/usr/bin/git cat-file -p refs/heads/master:.gitmodules' exited with code 128 saying: fatal: path '.gitmodules' does not exist in 'refs/heads/master'
...
    Caused by: com.atlassian.utils.process.ProcessException: Non-zero exit code: 128

Cause

The problem can have three possible causes:

Cause 1

The git version is not supported by the current Bitbucket version. You can check the range of supported git versions on the Bitbucket Supported Platforms page.

Cause 2

The error is caused by a missing .gitmodules file that git could not find for some reason.  When a repo with submodules is accessed in the UI, Bitbucket generally runs two commands in the background.  

  • git ls-tree
  • git cat-file

The cat-file command is having issues as ls-tree is having exited with 0 status at some places.

It is suggested to confirm whether there are any submodules in this repository and whether there have been any adjustments to the .gitmodules file or any of your submodule-related settings.

Cause 3

If a user mistakenly clones a git repository into another repository, and then goes on to commit it as a change (possibly by committing all changes), it is added as a submodule.

Solution

Based on the cause of the problem, the following solutions exist for this problem:

Solution 1

Downgrade git to a supported version.

Solution 2

Delete the .gitmodules file on a local copy of the repo and commit/push this to the remote. 

Just adding a blank .gitmodules file in the root directory can also fix the issue.

Solution 3 

Undo the changes on a local copy of the primary repository and commit/push to remote. 



Last modified on Oct 9, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.