Gateway error handling automatically sanitizes exception text to prevent encoding crashes while preserving meaningful error information for users.Documentation Index
Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
Quick Start
Simple Usage
Error handling is automatic — no configuration needed. When agents throw exceptions containing Unicode characters, the gateway safely converts them for bot replies.
How It Works
The gateway processes exceptions in three stages:- Root-cause extraction — identifies the underlying API error
- Unicode sanitization — converts symbols to ASCII-safe equivalents
- Safe reply — sends clean message to user via bot
Configuration Options
Error handling is automatic with no required configuration. The feature is included in PraisonAI versions containing PR #1754.Gateway Error Handling Reference
Source implementation details in PraisonAI PR #1754
Common Patterns
Recognized Error Types
The gateway automatically recognizes and formats these error patterns:| Pattern matched in exception | User-facing reply |
|---|---|
Error code: <N> - <msg> (OpenAI format) | Error <N>: <msg> |
HTTP <N>: <msg> | Error <N>: <msg> |
Contains quota (exceeded / insufficient) | API quota exceeded. Check billing. |
Contains rate limit (exceeded) | Rate limit exceeded. Try again later. |
Contains authentication (failed) | Authentication failed. Check API key. |
Contains timeout | Request timeout. Try again. |
| (anything else) | Original error text, sanitized to ASCII |
Symbol Replacements
Unicode symbols are replaced with ASCII equivalents:| Unicode | ASCII | Description |
|---|---|---|
⚠ | ! | Warning symbol |
✓ | OK | Check mark |
✗ | X | Cross mark |
→ | -> | Right arrow |
… | ... | Ellipsis |
" " | " | Smart quotes |
— – | -- - | Em/en dash |
Before vs After
Before PR #1754 (broken on Windows):Best Practices
Monitor Gateway Logs
Monitor Gateway Logs
Full Unicode exception details are preserved in gateway logs for debugging while users see clean ASCII-safe messages.
Handle API Quota Limits
Handle API Quota Limits
Set up billing alerts and monitor usage to prevent quota exceeded errors:
Test Cross-Platform Compatibility
Test Cross-Platform Compatibility
The Unicode-safe error handling works on Windows, macOS, and Linux:
Upgrade Legacy Environments
Upgrade Legacy Environments
No workaround needed on supported versions. Previously recommended environment variables (
PYTHONUTF8=1) are no longer required for the bot reply path.Related
Gateway Troubleshooting
Troubleshoot Windows charmap errors and other gateway issues
Bot Gateway
Configure multiple bots with the gateway server

