Errors
Guardrails APIs return structured, predictable errors to simplify handling and debugging.
Error Format
{
"error": "InvalidProfile",
"message": "Profile 'unknown-profile' does not exist"
}Common Errors
Unauthorized
{
"error": "Unauthorized",
"message": "Authentication required"
}Invalid Profile
{
"error": "InvalidProfile",
"message": "Profile not found"
}Validation Failed
{
"error": "ValidationFailed",
"message": "One or more guardrails failed"
}HTTP Status Codes
| Code | Meaning | | - | | | 400 | Invalid request | | 401 | Unauthorized | | 403 | Forbidden | | 404 | Resource not found | | 429 | Rate limited | | 500 | Internal error |
SDK Error Handling
The SDK throws typed errors:
try {
await client.validate(...)
} catch (err) {
console.error(err.message);
}Best Practices
- Log error
codeandmessage - Retry only idempotent requests
- Treat
429as backpressure
## What you now have
✔ Clean, professional API docs
✔ SDK-aligned examples
✔ Scalable content structure
✔ Zero React logic in MDX
✔ Ready for versioning & search