Forks are not listed in the upstream repository's "Forks" page because they have not been indexed on the Search 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

When a new repository is created as a fork of an existing repository, the new repo will be listed in the "Forks" page of the parent (also known as "upstream") repo.

However, if the new fork has not been indexed on the Search server (Elasticsearch or OpenSearch) for any reason (for example: if there are issues related to indexing), the fork will not be listed in the upstream's "Forks" page.

Click here for more details

When the "Forks" page of a repo is accessed, a request is made to the search server to retrieve the forks using the following endpoint:

request 1
/rest/search/latest/projects/<PROJECT_KEY>/repos/<REPO_SLUG>/forks

This endpoint retrieves the forks for the given PROJECT_KEY and REPO_SLUG.

If a valid JSON response is received, the application will use that data.

Sample request

curl -u <USER> https://bitbucket.myhost.com/rest/search/latest/projects/projects/PRJ1/repos/my-app/forks

Sample response

The JSON response below shows two forks for the PRJ1/my-app repo, which are: ~ADMIN1/my-app and ~ADMIN1/my-app-fork2

{
  "size": 2,
  "limit": 25,
  "isLastPage": true,
  "values": [
    {
      "slug": "my-app",
      "id": 43,
      "name": "my-app",
      "description": "this is a fork",
      "scmId": "git",
      "state": "AVAILABLE",
      "statusMessage": "Available",
      "forkable": true,
      "origin": {
        "slug": "my-app",
        "id": 22,
        "name": "my-app",
        "description": "Test repo",
        "scmId": "git",
        "state": "AVAILABLE",
        "statusMessage": "Available",
        "forkable": true,
        "project": {
          "key": "PRJ1",
          "id": 22,
          "name": "Project1",
          "public": false,
          "type": "NORMAL",
          "links": {
            "self": [
              {
                "href": "https://bitbucket.myhost.com/projects/PRJ1"
              }
            ]
          }
        },
        "public": true,
        "links": {
          "clone": [
            {
              "href": "https://bitbucket.myhost.com/scm/prj1/my-app.git",
              "name": "http"
            },
            {
              "href": "ssh://git@bitbucket.myhost.com:7999/prj1/my-app.git",
              "name": "ssh"
            }
          ],
          "self": [
            {
              "href": "https://bitbucket.myhost.com/projects/PRJ1/repos/my-app/browse"
            }
          ]
        }
      },
      "project": {
        "key": "~ADMIN1",
        "id": 1,
        "name": "Admin1",
        "type": "PERSONAL",
        "owner": {
          "name": "admin1",
          "emailAddress": "admin1@test.com",
          "id": 1,
          "displayName": "Admin1",
          "active": true,
          "slug": "admin1",
          "type": "NORMAL",
          "links": {
            "self": [
              {
                "href": "https://bitbucket.myhost.com/users/admin1"
              }
            ]
          }
        },
        "links": {
          "self": [
            {
              "href": "https://bitbucket.myhost.com/users/admin1"
            }
          ]
        }
      },
      "public": false,
      "links": {
        "clone": [
          {
            "href": "ssh://git@bitbucket.myhost.com:7999/~admin1/my-app.git",
            "name": "ssh"
          },
          {
            "href": "https://bitbucket.myhost.com/scm/~admin1/my-app.git",
            "name": "http"
          }
        ],
        "self": [
          {
            "href": "https://bitbucket.myhost.com/users/admin1/repos/my-app/browse"
          }
        ]
      }
    },
    {
      "slug": "my-app-fork2",
      "id": 643,
      "name": "my-app-fork2",
      "description": "this is another fork",
      "scmId": "git",
      "state": "AVAILABLE",
      "statusMessage": "Available",
      "forkable": true,
      "origin": {
        "slug": "my-app",
        "id": 22,
        "name": "my-app",
        "description": "Test repo",
        "scmId": "git",
        "state": "AVAILABLE",
        "statusMessage": "Available",
        "forkable": true,
        "project": {
          "key": "PRJ1",
          "id": 22,
          "name": "Project1",
          "public": false,
          "type": "NORMAL",
          "links": {
            "self": [
              {
                "href": "https://bitbucket.myhost.com/projects/PRJ1"
              }
            ]
          }
        },
        "public": true,
        "links": {
          "clone": [
            {
              "href": "https://bitbucket.myhost.com/scm/prj1/my-app.git",
              "name": "http"
            },
            {
              "href": "ssh://git@bitbucket.myhost.com:7999/prj1/my-app.git",
              "name": "ssh"
            }
          ],
          "self": [
            {
              "href": "https://bitbucket.myhost.com/projects/PRJ1/repos/my-app/browse"
            }
          ]
        }
      },
      "project": {
        "key": "~ADMIN1",
        "id": 1,
        "name": "Admin1",
        "type": "PERSONAL",
        "owner": {
          "name": "admin1",
          "emailAddress": "admin1@test.com",
          "id": 1,
          "displayName": "Admin1",
          "active": true,
          "slug": "admin1",
          "type": "NORMAL",
          "links": {
            "self": [
              {
                "href": "https://bitbucket.myhost.com/users/admin1"
              }
            ]
          }
        },
        "links": {
          "self": [
            {
              "href": "https://bitbucket.myhost.com/users/admin1"
            }
          ]
        }
      },
      "public": false,
      "links": {
        "clone": [
          {
            "href": "ssh://git@bitbucket.myhost.com:7999/~admin1/my-app-fork2.git",
            "name": "ssh"
          },
          {
            "href": "https://bitbucket.myhost.com/scm/~admin1/my-app-fork2.git",
            "name": "http"
          }
        ],
        "self": [
          {
            "href": "https://bitbucket.myhost.com/users/admin1/repos/my-app-fork2/browse"
          }
        ]
      }
    }
  ],
  "start": 0
}


Note that if Bitbucket does not receive a valid response (for example, if the the search server is unavailable), the application will perform another request that does not involve the search server to retrieve the forks. It will call the following endpoint:

request 2
/rest/api/1.0/projects/<PROJECT_KEY>/repos/<REPO_SLUG>/forks


But as long as the response for the first request to search server is a valid JSON object, Bitbucket will use that data from the first request.

Diagnosis

The first step is check if there are any issues on the search server.

Please refer to Troubleshooting steps for Bitbucket Server Code Search for procedures for diagnosing possible search server issues.

Case 1

One possible scenario where new repos are not getting indexed is when the search server has set itself to "read-only" mode because it detected that it is running low on disk space. 

Please see Elasticsearch reports HTTP status 403 in bitbucket logs for further info. 

The next step would be to analyze the requests made from the Bitbucket UI through the following procedures:

  1. Generate a HAR file while loading the "Forks" page of the upstream repo
  2. Check the browser's Console logs for any error messages
  3. In the HAR file, look for the /rest/search/latest/projects/<PROJECT_KEY>/repos/<REPO_SLUG>/forks endpoint and check whether the JSON response returns the expected forks or not

Cause

Forks are not displayed if they have not been indexed on the search server.

Case 1

For this case, the fork was not indexed because the search server has set itself to "read-only" mode due to low disk space.

Resolution

Case 1

Please follow the resolution procedures mentioned in: Elasticsearch reports HTTP status 403 in bitbucket logs.

Last modified on Nov 23, 2022

Was this helpful?

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