Skip to main content
This page collects the main error-handling references for AvatarKit server and client SDKs.

Server SDK

For backend integrations, use your server SDK’s structured error information as the main reference. Server-side integrations should account for session token failures, WebSocket handshake failures, runtime server errors, and unexpected connection closures.

Common server SDK error codes

These stable error codes are useful when building retry, logging, and alerting flows on your backend.
Error codeMeaning
sessionTokenExpiredSession token expired or is no longer authorized
sessionTokenInvalidSession token is invalid or empty
appIDUnrecognizedApp ID is not recognized by the server
appIDMismatchSession token belongs to a different app
avatarNotFoundRequested avatar does not exist
billingRequiredSession is blocked by billing requirements
creditsExhaustedRuntime or connect-time credits are exhausted
sessionDurationExceededSession hit a billing-enforced duration limit
unsupportedSampleRateAudio sample rate is not accepted by the handshake
invalidEgressConfigLiveKit or Agora egress configuration is invalid
egressUnavailableEgress service is unavailable or not configured
idleTimeoutSession was closed because no input was received
upstreamErrorUpstream internal service failed
protocolErrorInvalid protobuf payload or unexpected message sequence
connectionFailedTransport-level connection setup failed
connectionClosedWebSocket closed unexpectedly
serverErrorServer returned an unclassified error
invalidRequestClient request payload or parameters are invalid
unknownFallback code when the SDK cannot classify the failure

Server SDK error fields

When handling server SDK errors, check these fields to determine the correct recovery path:
  • code: stable SDK error code for programmatic handling
  • phase: where the failure happened, such as session_token, websocket_connect, or websocket_runtime
  • http_status: HTTP status for token or upgrade failures
  • server_code, server_title, server_detail: normalized details returned by the server
  • connection_id, req_id: correlation IDs for tracing requests in logs
  • close_code, close_reason: WebSocket close details for unexpected disconnects

Client SDK

For client-side troubleshooting, use the SDK-specific API and FAQ pages below.

Web SDK

The Web SDK API reference includes a dedicated Error Codes section for controller and runtime failures.

iOS SDK

Use the AvatarController.onError callback documented in the API reference to capture runtime failures and surface them in your app.

Android SDK

Use the AvatarController.onError callback documented in the API reference to handle rendering, networking, and playback failures on Android.
  1. Log the SDK error code and phase.
  2. Capture server correlation identifiers when available.
  3. Retry only transient failures such as connection interruptions or timeouts.
  4. Surface configuration and authentication errors to operators with the linked SDK references.