HTTP errors
WebSocket errors
If you send an invalid event (wrong type, malformed JSON, or a server-only event type), the server responds withEVENT_TYPE_SYSTEM_MESSAGE at level SYSTEM_MESSAGE_LEVEL_ERROR. The message describes what went wrong. Your WebSocket connection remains open — fix the issue and continue.
Rate limiting
Both HTTP endpoints and WebSocket messages are rate limited per session.- HTTP: returns
429 Too Many Requestswith aRetry-Afterheader - WebSocket: messages may be dropped
Access token errors
Returned fromPOST /api/v1/access-token.
Session creation errors
Returned fromPOST /api/v1/sessions.
WebSocket connection errors
Returned as HTTP errors during the WebSocket handshake, not as WebSocket events.An invalid
cursor value (for example, a non-numeric string) does not reject the connection. The server logs a warning and defaults to 0, replaying the full conversation history.Invalid event errors
These arrive asEVENT_TYPE_SYSTEM_MESSAGE events. The connection remains open.
Agent errors
These arrive asEVENT_TYPE_SYSTEM_MESSAGE during the conversation. They indicate a server-side issue — your client did nothing wrong.
Session state errors
These usually mean the session has expired or the server has lost track of it.Handoff errors
General debugging tips
- Check
metadata.custom. Custom metadata you sent is echoed back in error messages too — useful for correlating errors with specific user actions. - Watch for
SESSION_ENDafter errors. Some errors are followed by aSESSION_ENDevent. Always handle session end gracefully. - “High load” errors are transient. They self-resolve — implement a brief retry (2–5 seconds) before showing a permanent error.
- Connection dropped ≠ session ended. Reconnect with the same
session_idand acursorto resume. - Log the full event. When reporting issues to PolyAI, include the complete JSON of the error event (including
id,timestamp, andmetadata).

