# SDK error codes (/en/realtime-media/voice/reference/error-codes/web)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

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`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object. Print the error code through `AgoraRTCError.code`, because directly printing the `AgoraRTCError` object only shows the error message.

    ## Common error codes [#common-error-codes-12]

    | Error code              | Description                                                                                                                                                       | Resolution                                                                                                                          |
    | :---------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------- |
    | `UNEXPECTED_ERROR`      | An unhandled, unexpected error. Usually, this error includes a specific error message.                                                                            | Refer to the specific error message.                                                                                                |
    | `UNEXPECTED_RESPONSE`   | The 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_PARAMS`        | Illegal parameters.                                                                                                                                               | Follow the specific prompts to confirm the operation and pass the correct parameters according to the documentation.                |
    | `NOT_SUPPORTED`         | The browser does not support the feature.                                                                                                                         |                                                                                                                                     |
    | `INVALID_OPERATION`     | Illegal 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_ABORTED`     | The 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_RESTRICT` | Browser security policy restriction.                                                                                                                              | Make sure the web page is running in a [secure environment](https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts). |
    | `NO_ACTIVE_STATUS`      | The Agora project is inactive or disabled.                                                                                                                        | Go to Agora Console to confirm that the project status is enabled.                                                                  |

    ## Request-related error codes [#request-related-error-codes]

    ### Network connection [#network-connection]

    | Error code               | Description                                                                                                                          | Resolution                                                                                                               |
    | :----------------------- | :----------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------- |
    | `NETWORK_TIMEOUT`        | The 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_ERROR` | Response 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_ERROR`          | Unlocatable network error.                                                                                                           | None.                                                                                                                    |

    ### SDK internal requests [#sdk-internal-requests]

    | Error code      | Description                                                   | Resolution                                                                                                            |
    | :-------------- | :------------------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------- |
    | `WS_ABORT`      | WebSocket 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_DISCONNECT` | WebSocket is disconnected before requesting the Agora server. | Listen to `AgoraRTCClient.on("connection-state-change")` and retry after the connection state changes to `CONNECTED`. |
    | `WS_ERR`        | An error occurred in the WebSocket connection.                | Check the current browser support for WebSocket.                                                                      |

    ### Device management related error codes [#device-management-related-error-codes]

    | Error code                 | Description                                                            | Resolution                     |
    | :------------------------- | :--------------------------------------------------------------------- | :----------------------------- |
    | `ENUMERATE_DEVICES_FAILED` | Failed to enumerate local devices, usually due to browser limitations. | None.                          |
    | `DEVICE_NOT_FOUND`         | The specified device could not be found.                               | Pass in the correct device ID. |

    ### Track-related error codes [#track-related-error-codes]

    | Error code                    | Description                                                                                                                    | Resolution                                                                          |
    | :---------------------------- | :----------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------- |
    | `TRACK_IS_DISABLED`           | The track is disabled, usually because `Track.setEnabled()` is set to `false`.                                                 | Call `Track.setEnabled(true)` on the track before proceeding.                       |
    | `SHARE_AUDIO_NOT_ALLOWED`     | The 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_INVALID`        | Unsupported parameters for media capture.                                                                                      | Modify the media capture parameters or use the SDK's preset configuration.          |
    | `CONSTRAINT_NOT_SATISFIED`    | Unsupported parameters for media capture.                                                                                      | Modify the media capture parameters or use the SDK's preset configuration.          |
    | `PERMISSION_DENIED`           | Permission to obtain a media device was denied.                                                                                | Select **Allow** in the device permissions pop-up window.                           |
    | `NOT_READABLE`                | The user is authorized, but the media device is not accessible.                                                                | Check the current capture device and driver for errors.                             |
    | `FETCH_AUDIO_FILE_FAILED`     | Failed 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_ERROR` | Failed to read the local audio file.                                                                                           | Fill in the correct local audio file path.                                          |
    | `DECODE_AUDIO_FILE_FAILED`    | Audio 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.      |

    ## Client-related error codes [#client-related-error-codes]

    ### Join the channel [#join-the-channel]

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

    | Error code                         | Description                                                        | Resolution                                |
    | :--------------------------------- | :----------------------------------------------------------------- | :---------------------------------------- |
    | `UID_CONFLICT`                     | Duplicate UIDs in the same channel.                                | Use a different UID to enter the channel. |
    | `INVALID_UINT_UID_FROM_STRING_UID` | The String UID allocation service returned an illegal integer UID. | Use a different UID to enter the channel. |
    | `CAN_NOT_GET_PROXY_SERVER`         | Unable to get the cloud proxy service address.                     | None.                                     |
    | `CAN_NOT_GET_GATEWAY_SERVER`       | Unable to get the Agora server address.                            | None.                                     |

    ### Publish/Unpublish [#publishunpublish]

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

    | Error code                              | Description                               | Resolution                                                                                                                  |
    | :-------------------------------------- | :---------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------- |
    | `INVALID_LOCAL_TRACK`                   | An illegal `LocalTrack` was passed in.    | Check the incoming track and pass in the correct `LocalTrack`.                                                              |
    | `CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS` | A 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 [#subscribeunsubscribe]

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

    | Error code                     | Description                                                                                                               | Resolution                                                                                                                                                                                                                                                                                           |
    | :----------------------------- | :------------------------------------------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | `INVALID_REMOTE_USER`          | Illegal 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_PUBLISHED` | The 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_BROADCASTERS`    | The 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_SUBSCRIBERS`     | The number of hosts subscribed to by the current user exceeds the limit.                                                  | Subscribe to hosts on demand.                                                                                                                                                                                                                                                                        |

    ### Pushing stream to CDN [#pushing-stream-to-cdn]

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

    | Error code                                     | Description                                                                | Resolution                                                                                           |
    | :--------------------------------------------- | :------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------- |
    | `LIVE_STREAMING_TASK_CONFLICT`                 | The push stream task already exists.                                       | Call `Client.stopLiveStreaming` to stop this push streaming task before starting it again.           |
    | `LIVE_STREAMING_INVALID_ARGUMENT`              | Push stream parameter error.                                               | Refer to the API documentation for `Client.startLiveStreaming` and check the push stream parameters. |
    | `LIVE_STREAMING_INTERNAL_SERVER_ERROR`         | Internal 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_AUTHORIZED` | The push stream URL is occupied.                                           | Check whether the specified URL is occupied.                                                         |
    | `LIVE_STREAMING_CDN_ERROR`                     | An error occurred in the target CDN, causing the push stream task to fail. | Confirm the health of the target CDN.                                                                |
    | `LIVE_STREAMING_INVALID_RAW_STREAM`            | Push stream timeout.                                                       | Confirm that the target stream exists.                                                               |

    ### Cross-channel connection [#cross-channel-connection]

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

    | Error code                                 | Description                                                                                        |
    | :----------------------------------------- | :------------------------------------------------------------------------------------------------- |
    | `CROSS_CHANNEL_WAIT_STATUS_ERROR`          | An error occurred while waiting for the `AgoraRTCClient.on("channel-media-relay-state")` callback. |
    | `CROSS_CHANNEL_FAILED_JOIN_SRC`            | Failed to initiate a cross-channel media stream forwarding request.                                |
    | `CROSS_CHANNEL_FAILED_JOIN_DEST`           | Failed to accept a cross-channel media stream forwarding request.                                  |
    | `CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST` | The server failed to receive a cross-channel forwarded media stream.                               |
    | `CROSS_CHANNEL_SERVER_ERROR_RESPONSE`      | The server responded with an error.                                                                |

    
  
