HTTP errors seen while accessing api.chess.com

Sort:
Oldest
skelos

Hi,

I've made some of my scripts a little more forgiving of HTTP errors recently, and thought it might not hurt to document some of the errors seen "in the wild", so to speak.

This isn't criticism of api.chess.com or chess.com's operations and network staff; network errors are a fact of life especially if your network client's connection is complex. (Mine is.)

Giles

skelos

404 on accessing a profile

 

Explanation: I believe this is usually an account rename. I see it accessing per-country login records (~24 hours, cached I think 12 hours now). It's a permanent error: unless someone else chooses that account name, it's gone. It's not a reason (for me) to stop my script in its tracks, more ignore and move on.

skelos

504 Gateway Time-out

 

Explanation: ???

I've seen it while accessing profile data. No idea of the cause. 5xx indicates it's a temporary error; at present my code ignores that user and continues. An alternative might be to retry a limited number of times.

skelos

429 (rate limiting)

 

I've never seen this, but it's one chess.com would like you to pay attention to. Perhaps you're using more than three simultaneous connections; anyway, it's a request to slow up or come back later. My scripts quit if they see this (or they're coded to do so) but I've not seen it and not tried to trigger it intentionally.

skelos

500 timeout

 

Explanation: "Something broke."

I've seen this various times, especially when some part of my local network (Wi-Fi, ADSL2+, VPN) goes down. I'm not sure if I've seen an instance that would be chess.com's responsibility; my ISP can bounce my ADSL2+ connection any time they feel like it. And do. (Replacement connectivity rescheduled from "in a few weeks/months" at the start of 2018 to April-June 2019. Lovely. My current ISP will not be among those considered as a reseller when I have to change, and I don't care who knows (including them) as they for sure don't care!

Tricky_Dicky
skelos wrote:

504 Gateway Time-out

 

Explanation: ???

I've seen it while accessing profile data. No idea of the cause. 5xx indicates it's a temporary error; at present my code ignores that user and continues. An alternative might be to retry a limited number of times.

I did get this time out error whilst I developed one routine. I got the impression that the api server was acting slow so at the time I wondered in CdC where backing up or doing some housekeeping which was creating the problem. I put in a loop until error not found without a loop limit. A bit sloppy as it could potentially loop forever but it seemed to cure it at the time.

skelos

Thanks, @Tricky_Dicky. As a former OS support engineer, I'm a bit leery of potentially infinite loops. Granted for an application it's not so dire, but I've seen Bad Things Happen. happy.png 

 

"Oh, it's faster to loop here and poll than wait for an interrupt."

"Yeah, and when the hardware breaks and you poll forever and take down a major server because some USB keyboard is non-compliant?"

"Er ..."

 

I liked it better when I was contacted by someone to ask if some application documentation (then two or three years old) could be updated. "No," I said, "it's current. The application's not even been restarted for over a year, what's the problem?"

Teach me to put dates on online documentation. sad.png

Tricky_Dicky

Oh I do agree Giles. By my own admission I am a rank amateur coder.

It's such a long way from punched cards now that any idiot (me) with a keyboard can screw up an application.

Tricky_Dicky
skelos wrote:

404 on accessing a profile

 

Explanation: I believe this is usually an account rename. I see it accessing per-country login records (~24 hours, cached I think 12 hours now). It's a permanent error: unless someone else chooses that account name, it's gone. It's not a reason (for me) to stop my script in its tracks, more ignore and move on.

Think you can also get this for account closed.

skelos

No, I get a profile with "status:closed" or "status:fair_play_violations". Elsewhere we've asked for "status: self_closed" and "status:abuse" as well, but the account profile remains. (Unless chess.com rename it to something out-of-the-way, as I've heard suggested they sometimes may, probably usually for really offensive account names.)

skelos
skelos wrote:

No, I get a profile with "status:closed" or "status:fair_play_violations". Elsewhere we've asked for "status: self_closed" and "status:abuse" as well, but the account profile remains. (Unless chess.com rename it to something out-of-the-way, as I've heard suggested they sometimes may, probably usually for really offensive account names.)

Confirmation:

@ip62951413's account is closed

https://api.chess.com/pub/player/ip62951413

"status":"closed"
skelos

410 on accessing a profile

 

Explanation/guess based on an error in data my end is that 410 is used instead of 404 when a name is not a legal account name by chess.com's rules.

andreamorandini

@skelos you got "401" with PubAPIs? Do you remember which endpoint you requested?

skelos
andreamorandini wrote:

@skelos you got "401" with PubAPIs? Do you remember which endpoint you requested?

Not 401.

410, and 410 was the right answer for a malformed name trying to access a profile.

Example:

https://api.chess.com/pub/player/illegal%20name! (no space allowed)

Chrome reports:

This api.chess.com page can’t be found

It may have been moved or deleted.

HTTP ERROR 410
skelos

500 Can't connect to api.chess.com:443 (SSL connect attempt failed)

Explanation: "Is the Internet down?" (An in-joke, possibly dated, for IT support people)

Real explanation: ??? Clearly a network error, and 500 is about as non-specific as  you can get for a temporary network problem.

 

Seen trying to connect to the per-country player endpoint a few times in the last hour or so. Once I got a connection, it was fine. This update does use multiple connections ... perhaps I could change that, but it's slow already due to volume of data for some countries notably the US which has a large and active representation at chess.com.

...

https://api.chess.com/pub/country/ME/players

...

https://api.chess.com/pub/country/PL/players

bcurtis

A 504 response means that some server between you and us could not reach the next server upstream. Some of this we kinda-control, and we get reports from time to time and fix what we can. This is pretty equivalent to a 502, and one of the proxies we contract with will deliver a 524 from time to time. All of these are temporary and you can try again, but waiting might help.

Some of these servers do respond with 500, and that's completely unhelpful. A 500 should always mean that you contacted our servers and our code barfed trying to figure out how to respond. Could be a bug, a size limit (some of these responses are pretty big), or a loose cable somewhere. Perhaps a literal bug gnawing on the power lines. Like you said, this is the most generic.

A 503 means we had to take the servers offline, for maintenance or such. We try never to do this.

A 410 is like a super-404: not only is there no there there, there never ever will be any there there.

The "username in the URL" is pretty awkward due to the ability of people to change usernames. Once we establish our new permanent ID system, we might allow for IDs or usernames (either should work), and IDs would never change. Might happen this year, we'll see.

skelos

500 Server closed connection without sending any data back

 

Observed accessing profile or stats endpoint (my script was not specific in its warning message) but potentially could be seen for any endpoint I expect.

 

I treat this the same way as for 500 timeouts. The problem is probably closer to api.chess.com (which is actually quite complex to get to!) than to the client, but it doesn't matter: a retry should work and only if the error is persistent is there anything to be bothered about.

skelos

This is a new one to me, seen while fetching player profiles three times (not sure if consecutive for different members or if there were successful fetches in between):

409 Conflict

 

10.4.10 409 Conflict

The request could not be completed due to a conflict with the current state of the resource. This code is only allowed in situations where it is expected that the user might be able to resolve the conflict and resubmit the request. The response body SHOULD include enough information for the user to recognize the source of the conflict. Ideally, the response entity would include enough information for the user or user agent to fix the problem; however, that might not be possible and is not required.

Conflicts are most likely to occur in response to a PUT request. For example, if versioning were being used and the entity being PUT included changes to a resource which conflict with those made by an earlier (third-party) request, the server might use the 409 response to indicate that it can't complete the request. In this case, the response entity would likely contain a list of the differences between the two versions in a format defined by the response Content-Type.

 

I'm absolutely sure that I wasn't using a PUT request and "409 Conflict" doesn't tell me much. A temporary or permanent error code would be OK, but 409? I'm left wondering.

(Obviously, low priority stuff. But I've seen it so I'll document it.)

skelos

Update: seen once for clubs, twice for profiles.

 

https://api.chess.com/pub/player/owen4real/clubs (successful now when I test it in a browser)

https://api.chess.com/pub/player/owlyowl (also successful)

https://api.chess.com/pub/player/ozerbeha (ditto)

bcurtis

Did you record the complete response, including headers?

We do not deliberately send a 409 Conflict response for any reason on the public api.chess.com servers. Seeing the headers and response would help us identify what server on the path from you to us saw a problem.