> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.resemble.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.resemble.ai/_mcp/server.

# Error Handling

WebSocket responses include structured error objects. Differentiate between connection-level failures and recoverable synthesis issues.

## Unrecoverable Errors

Connection handshake or authentication failures close the socket immediately.

```json
{
  "type": "error",
  "success": false,
  "error_name": "ConnectionFailure",
  "message": "Failed to establish a connection.",
  "status_code": 401
}
```

Typical causes: invalid token, plan lacks WebSocket access, network filtering.

## Recoverable Errors

Synthesis-level problems keep the socket open so your client can retry.

```json
{
  "type": "error",
  "success": false,
  "error_name": "BadJSON",
  "error_params": {
    "explanation": "Provide your query to synthesize as text or SSML in the 'data' field"
  },
  "message": "Invalid JSON: Provide your query to synthesize as text or SSML in the 'data' field",
  "status_code": 400
}
```

Handle recoverable errors by logging `error_name`, inspecting `error_params`, and prompting the user to resend a corrected payload.