Error Codes
Complete reference of Mirra SDK error codes and how to handle them
The Mirra SDK returns structured error responses that include an error code, human-readable message, and optional details. This reference documents all error codes, their causes, and recommended solutions.
Error response format
All API errors follow a consistent JSON structure:
The success field is always false for errors. The code field contains a machine-readable error identifier. The message field provides a human-readable description. The optional details object contains additional context specific to the error.
HTTP status codes
The API uses standard HTTP status codes to indicate the general category of error:
| Status | Meaning | When It Occurs |
|---|---|---|
| 400 | Bad Request | Invalid request data or parameters |
| 401 | Unauthorized | Missing or invalid API key |
| 403 | Forbidden | Valid API key but insufficient permissions |
| 404 | Not Found | Resource does not exist |
| 409 | Conflict | Resource already exists or state conflict |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Internal Server Error | Server-side error |
| 503 | Service Unavailable | Service temporarily unavailable |
Authentication and authorization errors
AUTHENTICATION_ERROR
Authentication failed or credentials are missing.
Example response:
Common causes:
- Missing
X-API-Keyheader - Malformed API key
- Expired or revoked key
Solution:
Verify your API key is correct and include the X-API-Key: YOUR_KEY header in every request. If the key is expired or revoked, generate a new one.
UNAUTHORIZED
The request is not authorized.
Example response:
Common causes:
- Valid credentials but the session or token is not accepted
- Attempting an action that requires a different authentication level
Solution: Re-authenticate and retry the request.
PERMISSION_DENIED
You do not have permission to perform this action.
Example response:
Common causes:
- Attempting to access another user's resource
- API key lacks required permissions
- Resource is restricted
Solution: Verify you own the resource. Check that your API key has the appropriate permissions. If necessary, use an API key with broader access or contact support if you believe you should have access.
INVALID_API_KEY
The provided API key is not valid.
Example response:
Common causes:
- Typo in the API key
- Using a key from a different environment
- Key has been deleted
Solution: Double-check the API key value. Generate a new key if needed.
Validation errors
VALIDATION_ERROR
Request data failed validation.
Example response:
The details object may indicate which field failed validation and the value that was provided.
Common validation issues:
- Missing required fields
- Invalid field format
- Value out of allowed range
- Invalid enum value
- Duplicate key (e.g., subdomain already taken)
Solution:
Review the error message and details object to identify the problematic field. Ensure all required fields are present and meet the documented constraints.
INVALID_INPUT
The provided input is invalid.
Example response:
Common causes:
- Unsupported value for a known field
- Wrong data type
Solution: Check the API documentation for valid values and correct the input.
MISSING_REQUIRED_FIELD
A required field is missing from the request.
Example response:
Solution: Include the missing field in your request. Refer to the API documentation for the endpoint to see all required fields.
Resource errors
NOT_FOUND
The requested resource does not exist.
Example response:
Common causes:
- Invalid resource ID
- Resource was deleted
- Wrong endpoint
Solution: Verify the resource ID is correct. Check that the resource still exists by listing your resources. Ensure you are using the correct API endpoint.
ALREADY_EXISTS
A resource with the same identifier already exists.
Example response:
Common causes:
- Creating a resource with a duplicate name or subdomain
- Re-creating a resource that was not fully deleted
Solution: Use a different name or identifier for the new resource.
CONFLICT
The request conflicts with the current state of the resource.
Example response:
Common causes:
- Concurrent updates to the same resource
- Attempting an action that is invalid given the resource's current state
Solution: Fetch the latest state of the resource and retry the operation.
Rate limiting errors
RATE_LIMIT_EXCEEDED
You have exceeded your rate limit.
Example response:
The details object may contain additional information about the rate limit.
Solution: Wait before retrying. Implement exponential backoff in your application. Consider upgrading to a higher tier for increased rate limits.
Service errors
SERVICE_UNAVAILABLE
Service is temporarily unavailable.
Example response:
Solution: Wait and retry with exponential backoff. Check the service status page for ongoing incidents.
ADAPTER_ERROR
An error occurred in the underlying service adapter.
Example response:
Common causes:
- Third-party service failure
- Invalid adapter configuration
- Timeout communicating with an external service
Solution: Retry the request. If the error persists, check that the relevant integration is configured correctly.
OPERATION_FAILED
The requested operation could not be completed.
Example response:
Common causes:
- An unexpected condition prevented the operation from completing
- Partial failure in a multi-step operation
Solution: Retry the request. Check the error message for more context on what went wrong.
Generic errors
INTERNAL_ERROR
An unexpected server error occurred.
Example response:
Solution: Retry the request. If the error persists, contact support.
UNKNOWN_ERROR
An unclassified error occurred.
Example response:
Solution: Retry the request. If the error persists, contact support with details about the request that triggered the error.
Error handling best practices
Implement retry logic
Implement exponential backoff for retryable errors such as rate limits and service unavailability:
This function retries failed requests with exponential backoff.
Handle errors by code
Handle different error codes appropriately in your application:
Log error details
Always log error details for debugging and monitoring:
Common error scenarios
Creating a resource
| Error | Cause | Solution |
|---|---|---|
ALREADY_EXISTS | Resource with this name already exists | Use a different name |
MISSING_REQUIRED_FIELD | Missing required fields | Include all required fields |
VALIDATION_ERROR | Invalid field values | Check field constraints in error details |
Executing an operation
| Error | Cause | Solution |
|---|---|---|
NOT_FOUND | Resource does not exist | Verify the resource ID |
PERMISSION_DENIED | Not authorized to access | Verify ownership and permissions |
ADAPTER_ERROR | Underlying service failure | Retry or check integration config |
Authentication
| Error | Cause | Solution |
|---|---|---|
AUTHENTICATION_ERROR | Missing or malformed API key | Include valid X-API-Key header |
INVALID_API_KEY | API key is not recognized | Check key value or generate a new one |
PERMISSION_DENIED | Key lacks required permissions | Use a key with appropriate access |
See also
- Quickstart - Get started with the Mirra SDK
- Authentication - API key management and security
- Scripts - Deploy serverless functions
- Resources - Create API integrations
- Templates - Bundle resources and scripts