Error Codes
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 |
| 422 | Unprocessable Entity | Valid format but semantic errors |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Internal Server Error | Server-side error |
| 503 | Service Unavailable | Service temporarily unavailable |
Authentication errors
AUTHENTICATION_ERROR
Authentication failed or the API key is invalid.
Example response:
Common causes:
- Missing
Authorizationheader - Malformed API key
- Expired or revoked key
Solution:
Verify your API key is correct and include the Authorization: Bearer YOUR_KEY header in every request. If the key is expired or revoked, generate a new one.
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.
Validation errors
VALIDATION_ERROR
Request data failed validation.
Example response:
The details object indicates 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
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_SUBDOMAIN
Subdomain format is invalid.
Example response:
Subdomain requirements:
- 3 to 30 characters
- Lowercase letters, numbers, and hyphens only
- Must start with a letter
- Cannot start or end with a hyphen
Solution: Choose a subdomain that meets these requirements.
SUBDOMAIN_TAKEN
The requested subdomain is already in use.
Example response:
Solution: Choose a different subdomain. If you believe you already own this subdomain, list your existing resources to verify.
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.
AGENT_NOT_FOUND / SCRIPT_NOT_FOUND / RESOURCE_NOT_FOUND / TEMPLATE_NOT_FOUND
Specific resource type not found.
Example response:
These error codes are more specific variants of NOT_FOUND that indicate which resource type was not found.
State errors
ALREADY_PUBLISHED
Resource is already published to the marketplace.
Example response:
Solution: If you need to make changes, unpublish the resource first or update the published version directly using the update endpoint.
NOT_PUBLISHED
Attempting an action that requires the resource to be published.
Example response:
Solution: Publish the resource to the marketplace before attempting the action.
CANNOT_DELETE_PUBLISHED
Cannot delete a published resource.
Example response:
Solution: Unpublish the resource first, then delete it. This prevents accidental deletion of resources that other users may have installed.
Dependency errors
INVALID_DEPENDENCY
A referenced dependency does not exist or is invalid.
Example response:
Common causes:
- Referenced script or resource does not exist
- Dependency is not published
- Circular dependencies
Solution: Verify all dependencies exist and are published. Check for circular references in your dependency graph.
Rate limiting errors
RATE_LIMIT_EXCEEDED
You have exceeded your rate limit.
Example response:
The retryAfter field indicates how many seconds to wait before retrying.
Rate limit headers:
Solution:
Wait for the time specified in retryAfter before retrying. Implement exponential backoff in your application. Consider upgrading to a higher tier for increased rate limits.
Runtime errors
INVALID_CODE
Script code is invalid or failed validation.
Example response:
The details object provides the line number and specific error message.
Solution: Fix the syntax errors in your script code. Test your code locally before deploying.
INVALID_RUNTIME
Specified runtime is not supported.
Example response:
Solution:
Use a supported runtime: nodejs18 or python3.11.
System errors
INTERNAL_ERROR
An unexpected server error occurred.
Example response:
Solution: Retry the request. If the error persists, contact support with the request ID from the response headers.
SERVICE_UNAVAILABLE
Service is temporarily unavailable.
Example response:
Solution: Wait and retry with exponential backoff. Check the service status page for ongoing incidents.
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, respecting the retryAfter value for rate limit errors.
Handle errors by code
Handle different error codes appropriately in your application:
Log error details
Always log error details for debugging and monitoring:
Include the request ID when available to help support diagnose issues.
Common error scenarios
Creating an agent
| Error | Cause | Solution |
|---|---|---|
SUBDOMAIN_TAKEN | Subdomain already exists | Use a different subdomain |
INVALID_SUBDOMAIN | Invalid format | Follow subdomain rules (3-30 chars, lowercase, letters/numbers/hyphens) |
MISSING_REQUIRED_FIELD | Missing name or subdomain | Include all required fields |
VALIDATION_ERROR | Invalid field values | Check field constraints in error details |
Publishing to marketplace
| Error | Cause | Solution |
|---|---|---|
VALIDATION_ERROR | Missing description or category | Add required metadata |
ALREADY_PUBLISHED | Already published | Unpublish first or update directly |
INVALID_CODE | Script has syntax errors | Fix code syntax and test locally |
INVALID_DEPENDENCY | Missing dependencies | Ensure all dependencies are published |
Installing templates
| Error | Cause | Solution |
|---|---|---|
INVALID_DEPENDENCY | Missing dependency | Publish dependency first |
NOT_PUBLISHED | Template not published | Publish template to marketplace |
PERMISSION_DENIED | Cannot install own template | Use a different account for testing |
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