Spectron uses standard HTTP status codes and follows RFC 7807 Problem Details for all error responses.
Error response format
All errors return a JSON body with the following fields:
| Field | Description |
|---|---|
type | A URI identifying the error type. Stable across versions. |
title | A short, human-readable summary of the problem type. |
status | The HTTP status code. |
detail | A human-readable explanation specific to this occurrence. |
instance | The request path that produced the error. |
HTTP status codes
400 Bad Request
The request body or query parameters are invalid. Common causes:
Malformed JSON body
Missing required fields
Invalid field values (e.g. unknown
modefor knowledge query)Scope floor violation (requesting a scope narrower than the key's floor)
401 Unauthorized
No API-KEY header was provided, or the key is malformed.
403 Forbidden
The API key is valid but does not have permission to perform this operation. Common causes:
Agent key attempting a management operation
Key's scope floor does not include the requested scope
Agent key attempting to persist a reflection (requires supervisor principal)
404 Not Found
The requested resource does not exist.
409 Conflict
A resource with the same identifier already exists (e.g. creating a Context with a duplicate ID).
413 Payload Too Large
The uploaded file exceeds the per-Context size limit.
422 Unprocessable Entity
The request is syntactically valid but semantically invalid.
429 Too Many Requests
The Context has exceeded its token limit or rate limit.
500 Internal Server Error
An unexpected error occurred server-side. The detail field contains a request ID for support escalation.
503 Service Unavailable
The server is temporarily unable to handle requests – typically during a SurrealDB connection issue or startup.
SDK exceptions
Python SDK
| Exception | HTTP status | When |
|---|---|---|
SpectronAuthError | 401 | Missing or invalid API key |
SpectronForbiddenError | 403 | Insufficient principal or scope violation |
SpectronNotFoundError | 404 | Resource does not exist |
SpectronConflictError | 409 | Duplicate resource on create |
SpectronRateLimitError | 429 | Token or rate limit exceeded |
SpectronValidationError | 400, 422 | Invalid request payload |
SpectronServerError | 500, 503 | Server-side failure |
JavaScript SDK
| Error class | HTTP status | When |
|---|---|---|
SpectronAuthError | 401 | Missing or invalid API key |
SpectronForbiddenError | 403 | Insufficient principal or scope violation |
SpectronNotFoundError | 404 | Resource does not exist |
SpectronConflictError | 409 | Duplicate resource on create |
SpectronRateLimitError | 429 | Token or rate limit exceeded |
SpectronValidationError | 400, 422 | Invalid request payload |
SpectronServerError | 500, 503 | Server-side failure |
Ingestion pipeline errors
Documents that fail during async processing do not return HTTP errors – they set the document status to "failed" and populate the error field:
Poll GET /api/v1/{context_id}/documents/{id} to check document status. See Uploading documents for retry guidance.