Searching for user's repositories leads to "Unprocessable Entity" failure

I’m trying to get the public repositories of a given Github user using the repository Search API.

For some of the users it works properly, but for some I receive the following:

{
  "message": "Validation Failed",
  "errors": [
    {
      "message": "The listed users and repositories cannot be searched either because the resources do not exist or you do not have permission to view them.",
      "resource": "Search",
      "field": "q",
      "code": "invalid"
    }
  ],
  "documentation_url": "https://developer.github.com/v3/search/"

For example, the following query will trigger the error: https://api.github.com/search/repositories?q=user:ironshay

Going via the web UI (https://github.com/ironshay?tab=repositories) leads to a message that the user has no public repositories, which is what I expected the search API to return as well. 

Can you please provide details regarding this error and why it happens?

Thanks

1 Like

For whoever is interested in this, it seems that this error can appear if you search for a user that has only private repositories and no public repositories whatsoever.

So as I understand, you have several response options:

  1. User has no private repositories - you will receive a response with his public repositories.

  2. User has private repositories and public repositories - you will receive a response with his public repositories.

  3. User has only private repositories - you will receive this “Validation failed” error.

More details here

  

1 Like