Creating a branch on GraphQL API fails with unclear error: "Something went wrong while executing your query"

Hi there,

I’m trying to create a branch via the GraphQL API v4 and it fails most of the time, and works sometimes. Here’s the full query:

mutation CreateBranch($input: CreateRefInput!) {
    createRef(input: $input) {
        ref {
            name
        }
    }
}

Where $input is:

{
  "name": `refs/heads/<branchName>`,
  "oid": "<commitSha>",
  "repositoryId": "<repositoryId>"
}

The error I get is:

{
  "errors": [
    {
      "message": "Something went wrong while executing your query. Please include `DDFE:1DF0:186DE:1A836:62A848E2` when reporting this issue."
    }
  ]
}

I troubleshooted a bit more and it seems to be a timeout? It starts working if I manually ‘git pull’ the forked repository’s main branch.

Screenshot 2022-06-20 at 12.16.01


I have also tried to programmatically run this git pull by using the updateRef mutation, but it also fails if the forked branch is too far behind the main branch.