Skip to main content

Knowledge (formerly RAG) API Errors

RAG API error responses, HTTP status codes, business error codes, and retry strategy.

Every error response uses the same structure:
{
  "error": {
    "code": "INVALID_PARAMETER",
    "message": "field knowledge_base_id cannot be empty",
    "param": "knowledge_base_id"
  },
  "request_id": "req_xxx"
}

HTTP status codes

StatusMeaningWhat to do
400Invalid request parameterVerify the parameter
401Authentication failedCheck your API key
403ForbiddenRequest the appropriate permission scope
404Resource not foundVerify the ID
409Resource conflictUsually a duplicate name
413Request body too largeSplit the request
429Rate limitedBack off and retry
500Internal server errorRetry; contact support if it persists
503Service unavailableBack off and retry

Business error codes

codeHTTPMeaning
INVALID_PARAMETER400Parameter missing or malformed
UNAUTHORIZED401API key missing or invalid
FORBIDDEN403No permission for this operation
KB_NOT_FOUND404Knowledge Base not found
DOCUMENT_NOT_FOUND404Document not found
DATA_SOURCE_NOT_FOUND404Data source not found
KB_NAME_CONFLICT409Knowledge Base name already exists
QUOTA_EXCEEDED429Tenant quota exceeded
RATE_LIMITED429Endpoint rate limit hit
EMBEDDING_FAILED500Embedding service error
RETRIEVAL_TIMEOUT504Retrieval timed out — lower top_k or use a smaller Rerank model
SYNC_SOURCE_UNREACHABLE502Data source connection failed
Error codes for enabling Wiki on a Flagship knowledge base and for Wiki retrieval are below. Actual responses may prefix the code with the service name (e.g. Index.WikiConfigInvalid). Wiki configuration request fields use camelCase (e.g. wikiAutoUpdate, synthesisModelId), but on validation failure the field names in message are snake_case (e.g. wiki_auto_update, synthesis_model_id) — note the mapping.
codeHTTPDescription
WikiNotEnabled400Not all knowledge bases bound to the service have Wiki enabled during Wiki retrieval
WikiPreconditionNotMet400The knowledge base does not exist, does not belong to the current account, has been deleted, or its service is not yet provisioned
WikiEditionNotSupported400The knowledge base is not Flagship when enabling Wiki; or downgrading to Standard while requesting enable
WikiSceneNotSupported400The knowledge scene is not basic_document_qa when enabling Wiki
WikiOperationConflict409Requesting disable while enabling is in progress, requesting enable while disabling is in progress, or another Wiki operation is in progress
WikiConfigInvalid400Invalid Wiki configuration key, e.g. missing extraction group, missing or non-whitelisted synthesisModelId, invalid extractionGranularity, or over-length instructions; locate by the field name in message

Retry strategy

Error typeRetry?Interval
4xx (except rate limits)No—
429 rate limitedYesHonor the Retry-After header, or back off 1s / 2s / 4s
5xxYes1s / 2s / 4s, up to 3 retries
504 timeoutYesRetry immediately, up to 2 times

Troubleshooting

Every response includes a request_id. Include it when contacting support — it pinpoints the request in our logs.
Browse the endpoint reference, starting with List Knowledge Bases.