API troubles list issues

Hello!

I’m using the GitHub API in one of my project since a few months, and i’m dealing with a problem i never seen before

Sometimes, this request : “https://api.github.com/repos/Homebrew/homebrew-cask/issues?per_page=1&state=all” don’t return me anything. I have no answer at all

It seems to happen only on the repository Homebrew/homebrew-cask, i never get it with another repository

We can reproduce it by using this commands in the terminal :

curl -X GET "https://api.github.com/repos/Homebrew/homebrew-cask/issues?per_page=1&state=all"

And run it many times until get a empty answer

Hope someone can find where are the troubles :slight_smile:

Hi @joan-saum,

When I try with different state parameters, I get a result with “open” but not with “closed”. It is possible that the API is having an issue with the number of closed issues in that repository or maybe there’s an issue with a particular issue or pull request. I’ll let our product team know and see if they have any further insight.

Thanks!

Thanks for you reply @that-pat, let me know if you get some news !

Are you certain that you aren’t running into API rate limits? The reason why I ask is because asking for only one issue per page means that you’re going to run into your rate limit 30 times faster than not including the per_page qualifier.

Hello @lee-dohm

My soft used the per_page qualifier because i’m trying to know the number of issues.

So my logic is : i call only one time the road /issues?per_page=1 and i look at the variable LastPage the number. Because there is only 1 issue per page, the LastPage indicate the number of issues. I don’t iterate on all issues

Usually, if i run into API rate limits, i got an explicit error message.

I just tried 20 min ago to run many times the command:

curl -X GET "https://api.github.com/repos/Homebrew/homebrew-cask/issues?per_page=1&state=all

I run this command maybe around 40 times (manually, without a script).

I got one time this answer :

{
  "message": "Server Error"
}

And one other time, i got no answer at all, like what i describe in my first post.

The others answers was good. So, very rarely there is an error

Do you get the same error when you don’t include the per_page qualifier? Because it could be that the query you’re issuing is causing unexpected stress on a large repo. If you use the API more the way it is intended, it may work more reliably.

You would only have to issue two queries to get the same information. One to get the first page, which gives you the last page URL, then another to get the last page of issues. Count the number of pages, multiply by the number of items per page (defaults to 30), plus the number of items on the last page. That gives you the count of issues in two queries.

Yes

Actually, i tried many times this request (list all issues) :

curl -X GET "https://api.github.com/repos/Homebrew/homebrew-cask/issues?per_page=1&state=all"

With theper_page qualifier and without also. No problems

And then i tried this request (list only closed issues):

curl -X GET "https://api.github.com/repos/Homebrew/homebrew-cask/issues?state=closed"

Again, with theper_page qualifier and without. And i got the error i told before (One error is Server error, the other is just no answer at all)

I made a screenshot of my terminals, so you can also see the exact time of the request and your technical team can see the logs at this time

PS : The text before the request is the answer of github API with the same request. It show that sometimes it work.

Hi @that-pat

Any news from your product team about this error ?

@joan-saum, nothing definitive, unfortunately. They did experience an outage around the time that you asked this question which could have impacted the service in question. Have you gotten different results when trying again?

Yes i did

You can see my conversation with lee-dohm below. I tried monday again and i got some problems to list closed issue. I also post a screenshot of my terms so the tech team can see the exact time of my requests

@joan-saum, hm. That’s good information to have. Unfortunately, I think that might be beyond my level of expertise for troubleshooting this issue in a forum setting. Have you contacted private support? If you haven’t, you may want to so that we can do some advanced troubleshooting with you. You can submit a link to this forum post to prevent having to repeat yourself.