Cannot resolve any User but myself


#1

Querying user with my own username works just fine.

Query:

query {
  user(login: "jungomi") {
    login
  }
}

Result:

{
  "data": {
    "user": {
      "login": "jungomi"
    }
  }
}

But when I try to retrieve any other user, it returns an error that the user with the specified login could not be resolved. I’ve tried several different users and none of them seemed to work.
For example:

Query:

query {
  user(login: "github") {
    login
  }
}

Result:

{
  "data": {
    "user": null
  },
  "errors": [
    {
      "message": "Could not resolve to a User with the login of 'github'.",
      "locations": [
        {
          "line": 2,
          "column": 2
        }
      ],
      "path": [
        "user"
      ]
    }
  ]
}

#2

:wave: @jungomi,

Is it possible that the logins you’re providing to the user query are all organizations? This, for example, should work the way you expect:

query {
  organization(login:"github") {
    name
  }
}
{
  "data": {
    "organization": {
      "name": "GitHub"
    }
  }
}

If you’re unsure the login is a user or organization, you could use the repositoryOwner type:

query {
  repositoryOwner(login:"github") {
    ... on User {
      name
    }
    
    ... on Organization {
      name
    }
  }
}
{
  "data": {
    "repositoryOwner": {
      "name": "GitHub"
    }
  }
}

#3

You’re correct, I happened to only use organizations. I guess I got confused that the REST API accepts organizations on the users endpoint as well.

curl https://api.github.com/users/github

I will definitely use repositoryOwner instead, thank you.


Totally by accident I made a typo and tried githb, which could not be found, but is an actual user (it works in the REST API).

query {
  repositoryOwner(login:"githb") {
    ... on User {
      name
    }
    
    ... on Organization {
      name
    }
  }
}
{
  "data": {
    "repositoryOwner": null
  }
}

On a side note, repositoryOwner should probably also return an error to be spec-compliant and consistent with user and organization.


#4

Interesting! It looks like there’s significance to the login argument’s case. For example, the following works:

query {
  user(login:"gitHB") {
    login
  }
}

It seems sensible to be able to query on lower case logins. I’ve added this to an internal issue to track.

Thanks @jungomi!


#5

Thanks for your patience while we worked on this issue. It should now be resolved.