Skip to main content
Robust error handling is essential for production AI applications. This guide covers all error scenarios you may encounter with PromptGuard and how to handle them gracefully.

Error Types Overview

HTTP Status Codes

PromptGuard uses standard HTTP status codes with detailed error information:

Error Response Format

All errors follow a consistent JSON structure:

Authentication Errors

Invalid API Key (401)

Error Response:
Handling Strategy:

Insufficient Permissions (403)

Error Response:
Handling Strategy:

Rate Limiting Errors

Rate Limit Exceeded (429)

Error Response:
Advanced Retry Logic:

Security Policy Errors

Request Blocked (403)

When a request is blocked by a security policy, PromptGuard returns HTTP 403 with a JSON body that includes event_id and optionally dashboard_url (a direct link to the event in the dashboard for audit and debugging). Error Response:
Use event_id (or open dashboard_url if present) to find the event in the dashboard under Projects → Interactions for full audit context. Graceful Security Handling:

Provider Errors

Upstream Provider Issues (502)

Error Response:
Provider Failover Strategy:

Application-Level Error Handling

Comprehensive Error Handler

Error Monitoring and Alerting

Error Tracking Integration

Testing Error Handling

Error Simulation for Testing

Next Steps

Best Practices

Production deployment and reliability best practices

Rate Limits

Understanding and managing API rate limits

Troubleshooting

Common issues and debugging techniques

Monitoring

Set up comprehensive monitoring and alerts
Need help implementing robust error handling? Contact support for guidance on production-ready error handling strategies.