Errors and status codes
One shape for every failure. The HTTP status is the category; the code is the exact reason.
{
"success": false,
"source": "anilist",
"version": "v1",
"endpoint": "anime",
"error": {
"code": "VALIDATION_ERROR",
"message": "Path parameter \"id\" must be a number",
"hint": "Numeric ids only, up to 10 digits."
},
"meta": { "cached": false, "tookMs": 3, "generatedAt": "...", "requestId": "..." }
}Every code
| Code | HTTP | When it happens |
|---|---|---|
| BAD_REQUEST | 400 | The request could not be parsed at all. |
| VALIDATION_ERROR | 422 | A required parameter is missing, a number is not a number, or a value is too long. |
| UNAUTHORIZED | 401 | A key is required but absent, or the key is not valid. |
| FORBIDDEN | 403 | The caller may not do this, for example an admin route without a session. |
| NOT_FOUND | 404 | No scraper at that slug and version, or no endpoint at that path. |
| METHOD_NOT_ALLOWED | 405 | Only GET and OPTIONS are served. |
| SCRAPER_DISABLED | 403 | The scraper is registered but switched off. |
| RATE_LIMITED | 429 | The per minute window for this caller is spent. |
| SOURCE_ERROR | 502 | The upstream site answered with an error, or refused the request. |
| SOURCE_TIMEOUT | 504 | The upstream did not answer inside the request budget. |
| SCRAPER_ERROR | 500 | The scraper handler threw, usually a selector that no longer matches. |
| INTERNAL | 500 | The platform itself failed before or after the scraper ran. |
What to do with them
VALIDATION_ERRORis yours: fix the parameter. Retrying changes nothing.SOURCE_ERRORandSOURCE_TIMEOUTare upstream. One retry with backoff is reasonable, a loop is not.SCRAPER_ERRORmeans the scraper is broken against its source. It is reported on the admin dashboard with the message that was thrown.RATE_LIMITEDcarries the reset time. Sleep until then instead of hammering.