Smritea

Errors and codes

Every error code the Smritea API returns, its HTTP status, and the exception each SDK raises.

Ask AI about this page

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.

FieldMeaning
codeA stable error code, such as MEMORY_NOT_FOUND.
messageA text that explains the error.
request_idThe ID of the failed call. Quote it to support. It can also arrive in the X-Request-ID response header.
retryablePresent 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 statusPython, TypeScript and JavaGoC#
400SmriteaBadRequestError*SmriteaBadRequestErrorSmriteaBadRequestException
401SmriteaUnauthorizedError*SmriteaUnauthorizedErrorSmriteaUnauthorizedException
402SmriteaPaymentRequiredError*SmriteaPaymentRequiredErrorSmriteaPaymentRequiredException
403SmriteaForbiddenError*SmriteaForbiddenErrorSmriteaForbiddenException
404SmriteaNotFoundError*SmriteaNotFoundErrorSmriteaNotFoundException
409SmriteaConflictError*SmriteaConflictErrorSmriteaConflictException
422SmriteaUnprocessableError*SmriteaUnprocessableErrorSmriteaUnprocessableException
429SmriteaTooManyRequestsError*SmriteaTooManyRequestsErrorSmriteaTooManyRequestsException
5xx and otherSmriteaError*SmriteaErrorSmriteaException

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 statusCodeWhen it happens
402QUOTA_EXCEEDEDYou used all your quota for this billing period.
402INSUFFICIENT_QUOTAYou do not have enough quota left to do the operation.
429RATE_LIMIT_EXCEEDEDYou 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 statusCodeWhen it happens
400VALIDATION_ERRORThe request body has a syntax error or a field breaks its rules. For example, content is missing.
400VALIDATION_FAILEDA rule failed after parsing. Examples: a metadata value type, a time filter conflict, or participant_ids with conversation_id.
400EMPTY_APP_IDThe app ID header is empty.
400TOP_N_OUT_OF_RANGElimit is above 20.
400GRAPH_DEPTH_OUT_OF_RANGEgraph_depth is above 5.
403APP_FORBIDDENThe app ID is missing, or it does not match the API key's app.
403GENERIC_ERRORYour organization is inactive.

401, 404, 409 and 422

The table lists the 401, 404, 409 and 422 errors and when each one happens.

HTTP statusCodeWhen it happens
401GENERIC_ERRORThe API key is missing or invalid.
404MEMORY_NOT_FOUNDNo memory has that ID in your app.
409MEMORY_DUPLICATEAn add created, skipped and updated nothing. This is rare.
422CONTAINS_NOT_SUPPORTEDA metadata filter uses $contains.
422INVALID_APP_CONFIGThe stored settings of your app are not valid.

Server errors

The table lists the 500 errors and when each one happens.

HTTP statusCodeWhen it happens
500INTERNAL_ERRORAn unexpected failure.
500Other codes, such as RETRIEVE_FAILEDA step of the pipeline failed. Retry later.

When you see a 5xx, keep the request_id. It lets the team trace the call.

Last updated on