API Request Returning 502 Persistently


I’m using the GitHub API v3 with the Golang SDK.  I’m able to send the other requests in my program, but am having trouble with one call in particular.  Whenever I send a request to get all the repos in an organization, I am getting a 502 Server Error.  I am able to send other calls with that same client, so I don’t think that’s the issue.  However, I haven’t found any potential solutions to this in the documentation.  Any help woud be greatly appreciated!  Below is my function in case it helps: 

func getRepos(c *github.Client, org string) []*github.Repository {

	repos, _, err := c.Repositories.ListByOrg(
			Type: "public",

	if err != nil {
		fmt.Printf("Error getting Repos: %v", err)
	fmt.Printf("Total repos: %v\n", len(repos))
	return repos

Just some more information, I’m able to send the same request through my browser and Postman, and get a successful response of the collection of Repos.  In my case, the org is “kubernetes”, and the request is: 

GET https://api.github.com/orgs/kubernetes/repos

You are getting bitten by https://github.com/google/go-github/issues/1037. Removing the Accept header values fixed the problem for me.

1 Like