Overview
VIZOCHOK uses machine-readable error codes throughout the system. The backend sends structured error objects with acode field, and the SDK maps these codes to localized human-readable messages in the widget’s configured language (Ukrainian or English).
The backend never sends user-facing text. It sends a code, and the client renders the appropriate message.
WebSocket Error Codes
These errors are sent as{"type": "error", "code": "..."} messages over the WebSocket connection.
Rate Limiting Errors
Session Errors
Input Errors
System Errors
SDK Client-Side Error Codes
These errors are generated by the widget SDK itself (not from the server) and delivered through theonError callback.
WebSocket Close Codes
When the server closes the WebSocket connection, it uses these custom close codes:REST API Error Responses
REST API endpoints (admin panel, catalog management) return standard HTTP error responses:Common HTTP Status Codes
Error Localization
The SDK maintains built-in translations for all server error codes:Russian language (
'ru') uses the Ukrainian translations, since the AI always responds in Ukrainian for Russian-language input.Error Handling Best Practices
In the Widget
General Guidelines
- Do not suppress errors silently. At minimum, log them for debugging.
- Tenant limit errors are your concern. Monitor
tenant_daily_token_limitandtenant_monthly_token_limitand upgrade your plan before hitting limits. - The widget handles display. All error codes are rendered as user-friendly messages inside the chat panel automatically. The
onErrorcallback is for your application logic, not for displaying errors to users. - Connection errors auto-recover. The SDK has built-in reconnection with exponential backoff (1s to 10s, up to 30 attempts). You do not need to implement your own reconnection logic.
- The
retry_afterfield onrate_limit_exceededtells you how many seconds to wait. The widget displays a countdown timer automatically.