SDK error codes

Updated

List common Voice Calling SDK error codes, their causes, and suggested resolutions.

When interacting with the Agora API, the Voice SDK for Web may throw an error code. Receiving an error code indicates that the SDK has encountered an unrecoverable error that requires intervention from your app.

For asynchronous methods, the SDK returns a Promise to notify the result of the asynchronous operation, and the SDK throws the appropriate error code when the Promise is rejected. When a synchronous method call fails, the SDK throws an error code directly. The SDK may also throw some network-related error codes during internal operation.

The SDK error object AgoraRTCError inherits from the browser Error object. Print the error code through AgoraRTCError.code, because directly printing the AgoraRTCError object only shows the error message.

Common error codes

Error codeDescriptionResolution
UNEXPECTED_ERRORAn unhandled, unexpected error. Usually, this error includes a specific error message.Refer to the specific error message.
UNEXPECTED_RESPONSEThe server returned an unexpected response. This error is usually thrown when a network problem causes the client state to be inconsistent with the server state.Wait for the network to stabilize and retry the operation.
INVALID_PARAMSIllegal parameters.Follow the specific prompts to confirm the operation and pass the correct parameters according to the documentation.
NOT_SUPPORTEDThe browser does not support the feature.
INVALID_OPERATIONIllegal operation. This usually occurs because the operation cannot be performed in the current state.Confirm the order of operations. For example, confirm that you have joined the channel before publishing.
OPERATION_ABORTEDThe operation is aborted, usually due to poor network quality or disconnection that causes communication failure with the Agora server.Confirm the local network status through AgoraRTCClient.on("user-joined") and retry the operation.
WEB_SECURITY_RESTRICTBrowser security policy restriction.Make sure the web page is running in a secure environment.
NO_ACTIVE_STATUSThe Agora project is inactive or disabled.Go to Agora Console to confirm that the project status is enabled.

Network connection

Error codeDescriptionResolution
NETWORK_TIMEOUTThe request times out, usually because communication with the Agora server fails due to poor network quality or a broken connection.Confirm the local network conditions through AgoraRTCClient.on("user-joined") and retry the operation.
NETWORK_RESPONSE_ERRORResponse error, typically an illegal status code.Verify that the parameters for the operation are correct and pass the correct parameters according to the documentation.
NETWORK_ERRORUnlocatable network error.None.

SDK internal requests

Error codeDescriptionResolution
WS_ABORTWebSocket disconnected during a request to the Agora server.Listen to AgoraRTCClient.on("connection-state-change") and retry after the connection state changes to CONNECTED.
WS_DISCONNECTWebSocket is disconnected before requesting the Agora server.Listen to AgoraRTCClient.on("connection-state-change") and retry after the connection state changes to CONNECTED.
WS_ERRAn error occurred in the WebSocket connection.Check the current browser support for WebSocket.
Error codeDescriptionResolution
ENUMERATE_DEVICES_FAILEDFailed to enumerate local devices, usually due to browser limitations.None.
DEVICE_NOT_FOUNDThe specified device could not be found.Pass in the correct device ID.
Error codeDescriptionResolution
TRACK_IS_DISABLEDThe track is disabled, usually because Track.setEnabled() is set to false.Call Track.setEnabled(true) on the track before proceeding.
SHARE_AUDIO_NOT_ALLOWEDThe end user did not click Share Audio when the audio pop-up was presented on the screen.Prompt the end user to check Share Audio in the screen sharing pop-up window.
MEDIA_OPTION_INVALIDUnsupported parameters for media capture.Modify the media capture parameters or use the SDK's preset configuration.
CONSTRAINT_NOT_SATISFIEDUnsupported parameters for media capture.Modify the media capture parameters or use the SDK's preset configuration.
PERMISSION_DENIEDPermission to obtain a media device was denied.Select Allow in the device permissions pop-up window.
NOT_READABLEThe user is authorized, but the media device is not accessible.Check the current capture device and driver for errors.
FETCH_AUDIO_FILE_FAILEDFailed to download an online audio file.Fill in the correct online audio address and make sure it can be accessed properly.
READ_LOCAL_AUDIO_FILE_ERRORFailed to read the local audio file.Fill in the correct local audio file path.
DECODE_AUDIO_FILE_FAILEDAudio file decoding failed, probably because the audio file uses an encoding format that is not supported by browser WebAudio.Check whether browser WebAudio supports the encoding format of the audio file.

Join the channel

The following table lists the error codes thrown by the SDK when joining a channel fails:

Error codeDescriptionResolution
UID_CONFLICTDuplicate UIDs in the same channel.Use a different UID to enter the channel.
INVALID_UINT_UID_FROM_STRING_UIDThe String UID allocation service returned an illegal integer UID.Use a different UID to enter the channel.
CAN_NOT_GET_PROXY_SERVERUnable to get the cloud proxy service address.None.
CAN_NOT_GET_GATEWAY_SERVERUnable to get the Agora server address.None.

Publish/Unpublish

The following table lists the error codes thrown by the SDK when publishing or unpublishing a track fails:

Error codeDescriptionResolution
INVALID_LOCAL_TRACKAn illegal LocalTrack was passed in.Check the incoming track and pass in the correct LocalTrack.
CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKSA client publishes multiple video tracks.A client can publish only one video track at a time. If you want to publish multiple video tracks, create multiple clients.

Subscribe/Unsubscribe

The following table lists the error codes thrown by the SDK when subscribing or unsubscribing fails:

Error codeDescriptionResolution
INVALID_REMOTE_USERIllegal remote user. The remote user is not in the channel or has not published any media tracks yet.Subscribe only after receiving the AgoraRTCClient.on("user-published") event.
REMOTE_USER_IS_NOT_PUBLISHEDThe remote user has published an audio or video track that does not match the type specified in your subscribe operation.Ensure that the track type passed in by the subscribe operation matches the type returned by AgoraRTCClient.on("user-published"), or confirm before subscribing that the remote user has published the expected track type through AgoraRTCRemoteUser.hasVideo or AgoraRTCRemoteUser.hasAudio.
ERR_TOO_MANY_BROADCASTERSThe number of hosts in the channel exceeds the limit.Control the number of hosts. For example, call Client.setClientRole only when the user needs to publish an audio or video track to switch the user role to host.
ERR_TOO_MANY_SUBSCRIBERSThe number of hosts subscribed to by the current user exceeds the limit.Subscribe to hosts on demand.

Pushing stream to CDN

The following table lists the error codes thrown by the SDK when pushing a stream to a CDN fails:

Error codeDescriptionResolution
LIVE_STREAMING_TASK_CONFLICTThe push stream task already exists.Call Client.stopLiveStreaming to stop this push streaming task before starting it again.
LIVE_STREAMING_INVALID_ARGUMENTPush stream parameter error.Refer to the API documentation for Client.startLiveStreaming and check the push stream parameters.
LIVE_STREAMING_INTERNAL_SERVER_ERRORInternal error occurred on the push stream server.Retry the push stream operation. If it still fails, refresh the page and try again.
LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZEDThe push stream URL is occupied.Check whether the specified URL is occupied.
LIVE_STREAMING_CDN_ERRORAn error occurred in the target CDN, causing the push stream task to fail.Confirm the health of the target CDN.
LIVE_STREAMING_INVALID_RAW_STREAMPush stream timeout.Confirm that the target stream exists.

Cross-channel connection

The following table lists the error codes thrown by the SDK when cross-channel media relay fails:

Error codeDescription
CROSS_CHANNEL_WAIT_STATUS_ERRORAn error occurred while waiting for the AgoraRTCClient.on("channel-media-relay-state") callback.
CROSS_CHANNEL_FAILED_JOIN_SRCFailed to initiate a cross-channel media stream forwarding request.
CROSS_CHANNEL_FAILED_JOIN_DESTFailed to accept a cross-channel media stream forwarding request.
CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DESTThe server failed to receive a cross-channel forwarded media stream.
CROSS_CHANNEL_SERVER_ERROR_RESPONSEThe server responded with an error.