Internal error
INTERNAL_ERROR comes with HTTP 500. Something failed on our side while we handled your request.
What it means
Your request was fine as far as we can tell, but we could not answer it. The body never contains internal details. The detail is always the same text: The request could not be processed.
This is usually short-lived. Try again after a moment.
Example response
Response (500)
{
"type": "https://docs.finlight.me/errors/internal-error",
"title": "Internal server error",
"status": 500,
"detail": "The request could not be processed.",
"code": "INTERNAL_ERROR",
"requestId": "req-123"
}
Errors from in front of the API
A proxy or gateway in front of the API can also fail. Then you may get a 502, 503 or 504 with a body that is not JSON, for example an HTML page:
Response (502)
<html><head><title>502 Bad Gateway</title></head><body>Bad Gateway</body></html>
Treat every 5xx the same way, with or without a code, and do not try to parse the body as JSON first.
How to fix
- Retry with exponential backoff, for example after 1, 2 and 4 seconds, with some random jitter.
- Keep the same
X-Request-Idon every retry of the same call. - If the error persists, contact support and include the
requestIdfrom the error body, the route and the time. With therequestIdwe can find your request.
Retry
Yes, with backoff. This also applies to POST /v3/articles/search: a search only reads data, so it is safe to send again.
The client libraries retry 5xx answers, gateway errors, network errors and timeouts up to 3 times with growing waits. They send the same X-Request-Id on each try.
In the SDKs
| Language | Error |
|---|---|
| TypeScript, Python, Ruby | InternalServerError |
| .NET, Java, PHP | InternalServerException |
| Go | *finlight.APIError with APIKind == finlight.APIKindInternalError |
| Rust | Error::Api with api_kind() == ApiErrorKind::InternalError |
You only see this error after the library's retries ran out. A gateway error without JSON becomes the base API error with apiKind other and the status, and the raw body is kept.
Log the request id
import { InternalServerError } from 'finlight-client'
try {
await client.articles.search({ query: 'ticker:NVDA' })
} catch (err) {
if (err instanceof InternalServerError) {
console.error('finlight failed, send this to support:', err.requestId)
}
throw err
}
On WebSocket
On an open WebSocket, a connection.error frame with the code INTERNAL_ERROR means that one message could not be handled. The connection stays open. Log it and keep going.
connection.error
{
"event": "connection.error",
"payloadVersion": 3,
"data": { "code": "INTERNAL_ERROR", "message": "Message processing failed" }
}
A connection refused at connect with HTTP status 500 (body {"error":"Internal server error"}) should be retried with backoff. The client libraries do this for you. See Lifecycle & limits.