Repository 'type': 'NOT_FOUND' graphQL API


Recently i’ve been working with graphql API on github and i have some querys working correctly, including a mutation.

This is on Enterprise btw.

One simple query that i use is the following (owner/name as an example):

query MyQuery {
  repository(name: "name", owner: "owner") {

But there is a weird problem.
It works fine on my PC (Python Script with requests library) and a few others PC’s aswell.
But on some PC’s, and most importantly on our build machine, it says NOT_FOUND on 2 out of 33 different repository’s (always the same 2).

The error is the following (owner/name as an example):

{‘type’: ‘NOT_FOUND’, ‘path’: [‘repository’], ‘locations’: [{‘line’: 3, ‘column’: 9}], ‘message’: “Could not resolve to a Repository with the name ‘owner/name’.”}

Some things that i have tried:

  • Different tokens
  • Curl command seems to work, even on the affected PC’s.

Line of code that i use for the request on Python.

response =, json=query, headers=self._headers)

Does anyone had this problem aswell?

Thank you.

Looks like the same issue as Graphql repository query fails to redirect in some cases


Meantime i managed to solve this.

Not entirely sure about the science behind this.
After printing the post payload that i was sending to github (response.requests.headers) i found out that the requests library was dropping the headers. After some reading it seems that it’s due to a redirection of url and for security reasons it drops the headers that contains my token.

What i did to solve was the following:
(This class is used to avoid using .netrc config)

class NullAuth(requests.auth.AuthBase):
    def __call__(self, r):
        return r

And than passed it along:

response =, json=query, headers=self._headers, auth=NullAuth())