Error Handling
When an API request fails, you’ll receive a structured error response with details about what went wrong.Error Response Format
All errors follow this consistent format:| Field | Description |
|---|---|
success | Always false for error responses |
error.message | A human-readable description of the error |
error.code | A machine-readable error code for programmatic handling |
Error Codes
Authentication Errors
| Code | HTTP Status | Description |
|---|---|---|
AUTH_REQUIRED | 401 | No authentication was provided in the request headers |
INVALID_API_KEY | 401 | The API key is invalid, malformed, or has expired |
INVALID_AUTH_FORMAT | 401 | Token format not recognized (must start with sigmic_ or eyJ) |
INVALID_TOKEN | 401 | JWT is invalid or has expired |
JWT_NOT_CONFIGURED | 501 | Server does not have JWT signing configured |
ORIGIN_NOT_ALLOWED | 403 | Request origin not in widget app’s allowed origins list |
Widget Token Errors
| Code | HTTP Status | Description |
|---|---|---|
MISSING_CREDENTIALS | 400 | appId or appSecret not provided in token request |
MISSING_END_USER_ID | 400 | endUserId not provided or empty |
INVALID_CREDENTIALS | 401 | Widget app credentials are invalid |
INVALID_EXPIRES_IN | 400 | expiresIn format invalid (must be e.g. "1h", "30m") |
INVALID_ENV | 400 | Invalid env var name or non-string value |
Authorization Errors
| Code | HTTP Status | Description |
|---|---|---|
FORBIDDEN | 403 | You don’t have permission to perform this action |
- A member tries to perform an admin-only action (inviting members, changing roles)
- A user tries to access a project they haven’t been granted access to
- A non-admin tries to manage project members
Resource Errors
| Code | HTTP Status | Description |
|---|---|---|
NOT_FOUND | 404 | The requested resource (task, tool call) does not exist |
Validation Errors
| Code | HTTP Status | Description |
|---|---|---|
VALIDATION_ERROR | 400 | Request parameters are invalid or missing |
Task Execution Errors
| Code | HTTP Status | Description |
|---|---|---|
EXECUTION_ERROR | 500 | Task execution failed due to an internal error |
ALREADY_RUNNING | 400 | Cannot perform action because task is already running |
Handling Errors in Code
JavaScript
Python
SSE Stream Errors
Errors during streaming are delivered aserror events:
Best Practices
Always check success field
Even on 200 responses, verify
success: true before processing dataLog error codes
Log the
code field for debugging and monitoringImplement retries
For transient errors (5xx), implement exponential backoff retries
Validate inputs
Validate inputs client-side to avoid unnecessary API calls