Errors and codes
Every error code the Smritea API returns, its HTTP status, and the exception each SDK raises.
Every failed call returns an HTTP status and an error body. The SDK turns the status into a typed exception. The body holds a stable error code that you can log and match.
A quota error (402) and a rate limit error (429) are different. A 402 means your plan quota has run out. A 429 means you sent calls too fast.
The error body
Every failed call returns an error body. The table lists its fields.
| Field | Meaning |
|---|---|
code | A stable error code, such as MEMORY_NOT_FOUND. |
message | A text that explains the error. |
request_id | The ID of the failed call. Quote it to support. It can also arrive in the X-Request-ID response header. |
retryable | Present only when the server marks the error retryable. |
Each SDK exposes these as fields on the exception. Each SDK picks the exception from the HTTP status, not from the code.
Exceptions by status
The table maps each HTTP status to the exception that each SDK raises.
| HTTP status | Python, TypeScript and Java | Go | C# |
|---|---|---|---|
| 400 | SmriteaBadRequestError | *SmriteaBadRequestError | SmriteaBadRequestException |
| 401 | SmriteaUnauthorizedError | *SmriteaUnauthorizedError | SmriteaUnauthorizedException |
| 402 | SmriteaPaymentRequiredError | *SmriteaPaymentRequiredError | SmriteaPaymentRequiredException |
| 403 | SmriteaForbiddenError | *SmriteaForbiddenError | SmriteaForbiddenException |
| 404 | SmriteaNotFoundError | *SmriteaNotFoundError | SmriteaNotFoundException |
| 409 | SmriteaConflictError | *SmriteaConflictError | SmriteaConflictException |
| 422 | SmriteaUnprocessableError | *SmriteaUnprocessableError | SmriteaUnprocessableException |
| 429 | SmriteaTooManyRequestsError | *SmriteaTooManyRequestsError | SmriteaTooManyRequestsException |
| 5xx and other | SmriteaError | *SmriteaError | SmriteaException |
All the other exceptions derive from SmriteaError (SmriteaException in C#). In Go, each typed error embeds SmriteaError, so check the typed errors first.
Read the error fields
Catch the error and read its HTTP status, its error code and its request ID. This code asks for a memory that does not exist.
from smritea import SmriteaError
try:
client.get("mem_missing")
except SmriteaError as e:
print(e.http_status, e.code, e.request_id)The Go tab checks the typed error first, because *smritea.SmriteaError does not match a typed error. The Go and Java tabs take the client as a parameter.
Quota and rate limit errors
The table lists the errors you see when you run out of quota or exceed a rate limit.
| HTTP status | Code | When it happens |
|---|---|---|
| 402 | QUOTA_EXCEEDED | You used all your quota for this billing period. |
| 402 | INSUFFICIENT_QUOTA | You do not have enough quota left to do the operation. |
| 429 | RATE_LIMIT_EXCEEDED | You went over a rate limit for the second, the minute or the day. |
The SDK retries a 429. It never retries a 402. See Handle errors and retries.
Error codes by status
400 and 403
The table lists the 400 and 403 errors and when each one happens.
| HTTP status | Code | When it happens |
|---|---|---|
| 400 | VALIDATION_ERROR | The request body has a syntax error or a field breaks its rules. For example, content is missing. |
| 400 | VALIDATION_FAILED | A rule failed after parsing. Examples: a metadata value type, a time filter conflict, or participant_ids with conversation_id. |
| 400 | EMPTY_APP_ID | The app ID header is empty. |
| 400 | TOP_N_OUT_OF_RANGE | limit is above 20. |
| 400 | GRAPH_DEPTH_OUT_OF_RANGE | graph_depth is above 5. |
| 403 | APP_FORBIDDEN | The app ID is missing, or it does not match the API key's app. |
| 403 | GENERIC_ERROR | Your organization is inactive. |
401, 404, 409 and 422
The table lists the 401, 404, 409 and 422 errors and when each one happens.
| HTTP status | Code | When it happens |
|---|---|---|
| 401 | GENERIC_ERROR | The API key is missing or invalid. |
| 404 | MEMORY_NOT_FOUND | No memory has that ID in your app. |
| 409 | MEMORY_DUPLICATE | An add created, skipped and updated nothing. This is rare. |
| 422 | CONTAINS_NOT_SUPPORTED | A metadata filter uses $contains. |
| 422 | INVALID_APP_CONFIG | The stored settings of your app are not valid. |
Server errors
The table lists the 500 errors and when each one happens.
| HTTP status | Code | When it happens |
|---|---|---|
| 500 | INTERNAL_ERROR | An unexpected failure. |
| 500 | Other codes, such as RETRIEVE_FAILED | A step of the pipeline failed. Retry later. |
When you see a 5xx, keep the request_id. It lets the team trace the call.
Related pages
Last updated on



