Error Codes

Complete list of error codes for the SnackPrompt AI Engine API.

Overview

The API returns errors in the following format:

{
  "detail": "Message describing the error"
}

HTTP Codes

Code
Name
Description

200

OK

Successful request

202

Accepted

Request accepted for processing

400

Bad Request

Validation error or invalid parameters

401

Unauthorized

Not authenticated

403

Forbidden

No permission to access resource

404

Not Found

Resource not found

422

Unprocessable Entity

Invalid data

429

Too Many Requests

Rate limit exceeded

500

Internal Server Error

Internal server error

503

Service Unavailable

Service temporarily unavailable


Common Errors

400 - tenant_id Required

Response:

Cause: The tenant_id was not included in the filters object.

Solution: Add tenant_id to filters:


400 - Query Required

Response:

Cause: The query field was not provided in a search or chat request.

Solution: Add the query field:


400 - Invalid Filters

Response:

Cause: An unknown filter was provided.

Solution: Use only valid filters. See Filter Reference.


404 - Elemental Not Found

Response:

Cause: The provided elemental_id doesn't exist or hasn't been ingested.

Solution:

  1. Check if the ID is correct

  2. Check if the elemental was ingested

  3. Wait for ingestion to complete (asynchronous process)


422 - Invalid Data

Response:

Cause: A field was provided with the wrong type.

Solution: Check data types. See Data Models.


429 - Rate Limit

Response:

Cause: Too many requests in a short period.

Solution:

  1. Wait the indicated time

  2. Implement retry with exponential backoff

  3. Consider upgrading your plan for more requests

Response headers:


500 - Internal Error

Response:

Cause: Unexpected server error.

Solution:

  1. Try again in a few seconds

  2. If it persists, contact support

  3. Include the trace_id if available


503 - Service Unavailable

Response:

Cause: The service or a dependency is unavailable.

Solution:

  1. Wait a few minutes

  2. Check status at /health/detailed

  3. Contact support if it persists


Streaming Errors

Error During Streaming

During streaming chat, errors are sent as SSE events:

Solution: Handle the error event in your client:


JavaScript/TypeScript

Python


Retry with Exponential Backoff

For 429 and 5xx errors, implement retry with backoff:

Last updated

Was this helpful?