TRTC SDK v5.0 defines 8 types of error codes, handled through the RtcError object.
- See:
Example
// 1. API call error
trtc.startLocalVideo().catch(error => {
if (error.code === TRTC.ERROR_CODE.DEVICE_ERROR) {}
});
// 2. Non-API error (SDK cannot recover after internal retry)
trtc.on(TRTC.EVENT.ERROR, (error) => {
if (error.code === TRTC.ERROR_CODE.OPERATION_FAILED) {}
});
Members
(static) INVALID_PARAMETER
- Default Value:
-
- 5000
Description: The parameters passed in when calling the interface do not meet the API requirements.
Handling suggestion: Please check whether the passed-in parameters comply with the API specifications, such as whether the parameter type is correct.
| extraCode | Description |
|---|---|
| 5001 | Required parameter is missing |
| 5002 | Incorrect parameter type |
| 5003 | Parameter is empty |
| 5004 | Incorrect parameter instance |
| 5005 | Parameter value out of range |
| 5006 | Parameter value is less than 0 |
| 5007 | Parameter value is below the minimum |
| 5008 | Parameter value exceeds the maximum |
| 5009 | elementId not found on the page |
| 5010 | Parameter is not of type HTMLElement |
| 5011 | streamId does not meet specifications |
| 5012 | roomId out of valid range [1, 4294967294] |
| 5013 | strRoomId is not a valid string |
| 5014 | streamType is required when userId is not '*' |
| 5015 | Either roomId or strRoomId must be provided |
| 5016 | roomId must be numeric. Use strRoomId for string room IDs |
| 5017 | ArrayBuffer size cannot be empty. Thrown by TRTC.sendSEIMessage, TRTC.sendCustomMessage |
| 5018 | ArrayBuffer is oversized. Thrown by TRTC.sendSEIMessage, TRTC.sendCustomMessage |
(static) INVALID_OPERATION
- Default Value:
-
- 5100
Description: The API prerequisite requirements are not met.
Handling suggestion: Check whether the calling logic complies with the API prerequisites. Common cases: 1. Calling role-switching before entering the room; 2. The remote user or stream being played does not exist.
| extraCode | Description |
|---|---|
| 5101 | API called before entering the room (e.g. startRemoteVideo, muteRemoteAudio, switchRole require entering the room first) |
| 5102 | Remote user does not exist (e.g. the userId passed to startRemoteVideo is not in the room) |
| 5103 | Remote stream type does not exist (e.g. streamType=SUB is specified but the remote user is not screen sharing) |
| 5104 | Repeated API call (e.g. calling enterRoom again after already in the room) |
| 5105 | Camera not enabled (e.g. virtual background requires camera to be active) |
| 5106 | Microphone not enabled (e.g. AI denoiser requires microphone to be active) |
| 5107 | Role TRTC.TYPE.ROLE_AUDIENCE cannot call this API |
| 5108 | SEI not enabled. Initialize with TRTC.create({ enableSEI: true }) |
| 5109 | Must publish video before calling sendSEIMessage |
(static) ENV_NOT_SUPPORTED
- Default Value:
-
- 5200
Description: The current environment does not support this function.
Handling suggestion: Use TRTC.isSupported to detect browser capabilities. If unsupported, guide users to switch browsers. See Check Environment and Device Before Calls
| extraCode | Description |
|---|---|
| 5201 | Page protocol is not HTTPS (audio/video capture is not supported) |
| 5202 | Browser does not support WebRTC (browser version may be too low) |
| 5203 | Browser does not support H264 encoding |
| 5204 | Browser does not support H264 decoding |
| 5205 | Browser does not support screen sharing |
| 5206 | Browser does not support small stream encoding |
| 5207 | Browser does not support SEI sending/receiving |
| 5208 | Browser does not support WebGL |
| 5209 | Browser version does not support this feature. Please upgrade to the latest version |
| 5210 | Browser version does not support this plugin. Please upgrade to the latest version |
(static) DEVICE_ERROR
- Default Value:
-
- 5300
Description: Exception occurred when obtaining device or capturing microphone/camera/screen sharing.
Affected APIs: trtc.startLocalAudio, trtc.startLocalVideo, trtc.startScreenShare
Suggestion: Guide users to check whether the device has a camera/microphone, whether the system has authorized the browser, and whether the browser has authorized the page. It is recommended to add a device detection step before entering the room. See Check Environment and Device Before Calls
For more detailed exception categories, refer to the following extraCode:
| extraCode | Description |
|---|---|
| 5301 | NotFoundError — No matching media device found (audio, video, or screen sharing). E.g. requesting video on a PC without a camera. Suggestion: Guide users to check external devices before the call. |
| 5302 | NotAllowedError — User denied the microphone/camera/screen sharing request, or system permission was denied. Suggestion: Prompt the user to grant permission. If denied by the system, call rtcError.handler to jump to system settings. |
| 5303 | NotReadableError — Device is authorized but inaccessible, possibly due to hardware errors or another application occupying the device. Suggestion: Prompt the user: "Unable to access camera/microphone. Please close other apps using the device and try again." On Windows, note that the camera is exclusive (microphone is not). |
| 5304 | OverconstrainedError — Invalid cameraId/microphoneId. Suggestion: Verify that the ID comes from the device enumeration API. |
| 5305 | InvalidStateError — Page is not activated (no user interaction yet). Suggestion: Start camera/microphone only after the user clicks the page. |
| 5306 | SecurityError — System security policy blocks device access. Suggestion: Check system restrictions. Start camera/microphone after user interaction. |
| 5307 | AbortError — Device cannot be used for unknown reasons. Suggestion: Try a different device or browser, and verify the device is working. |
| 5308 | Camera capture failed after SDK retry. Reason: Camera error or user revoked browser capture permission. Suggestion: Prompt user to check camera status and permissions. |
| 5309 | Microphone capture failed after SDK retry. Reason: Microphone error or user revoked browser capture permission. Suggestion: Prompt user to check microphone status and permissions. |
| 5310 | Microphone sample rate mismatch. Prevents use of AIDenoiser, AudioMixer, and VoiceChanger. Reason: Firefox does not support connecting AudioNodes across different sample rates. Suggestion: Use another browser such as Chrome. |
Reference: getUserMedia exceptions and getDisplayMedia exceptions
Example
trtc.startLocalVideo(...).catch(function(rtcError) {
if(rtcError.code == TRTC.ERROR_CODE.DEVICE_ERROR) {
// Guide the user to check the device
switch(rtcError.extraCode) {
case 5301:
// Can't find a camera or microphone, guide the user to check if the microphone and camera are working.
break;
case 5302:
if (error.handler) {
error.handler();
// Prompt the user the browser permission(camera/microphone/screen sharing) has been denied by system. The browser will jump to the System Settings APP, please enable the relevant permissions!
} else {
// Prompt the user to allow camera, microphone, and screen share capture permissions on the page.
}
break;
// ...
}
}
})
(static) SERVER_ERROR
- Default Value:
-
- 5400
Description: Abnormal data returned from the server.
Affected APIs: enterRoom, startLocalVideo, startLocalAudio, startScreenShare, startRemoteVideo, switchRole
Handling suggestion: Server exceptions are usually encountered during development. Common causes: expired userSig, account arrears, TRTC service not enabled, etc.
| extraCode | Description |
|---|---|
| 5401 | This feature requires a purchased package |
| -8 | Incorrect sdkAppId. Please verify the value |
| -10012 | roomId is missing or invalid. Use strRoomId for string room IDs |
| -10015 | Failed to obtain server node |
| -10016 | Server internal communication timeout (3s) |
| -10035 | Server-side room switch failed |
| -10037 | Anchor role does not support room switching |
| -100006 | Permission check failed. Verify the privateMapKey in enterRoom. See Enable advanced permission control |
| -100013 | Account arrears. Check your service status in the TRTC Console |
| -100021 | Server overload, failed to enter room |
| -100022 | Server allocation failed |
| -100024 | TRTC service not enabled. Enable it in the IM Console |
| -102006 | Flow control error: add user failed |
| -102010 | No permission to create room (advanced permission control enabled). See Enable advanced permission control |
| -102023 | Request parameter error (backend) |
| 70001 | userSig expired. Regenerate and retry. If it expires immediately, check if the validity period is too short or set to 0 |
| 70002 | userSig length is 0. Verify your signature calculation |
| 70003 | userSig verification failed (content may be truncated). Check if buffer length is sufficient |
| 70004 | userSig verification failed (content may be truncated). Check if buffer length is sufficient |
| 70005-70008 | userSig verification failed. Use tools to verify the generated userSig |
| 70009 | userSig verification failed with business public key. Ensure the private key and sdkAppId match |
| 70010 | userSig verification failed. Use tools to verify the generated userSig |
| 70013 | userId in userSig does not match the request userId |
| 70014 | sdkAppId in userSig does not match the request sdkAppId |
| 70015 | No verification method found for the sdkAppId and account type. Confirm the account integration is complete |
| 70016 | Public key length is 0. Confirm the public key has been uploaded. If re-uploaded, wait 10 minutes and retry |
| 70017 | Third-party ticket verification timeout. Retry or contact TLS support (QQ: 3268519604) |
| 70018 | Third-party ticket verification failed |
| 70019 | The ticket field is empty. Please fill in userSig correctly |
| 70020 | sdkAppId not found. Confirm it is configured on Tencent Cloud |
| 70052 | userSig expired. Regenerate and retry |
| 70101 | Request packet is empty |
| 70102 | Incorrect account type in request |
| 70103 | Invalid phone number format |
| 70104 | Invalid email format |
| 70105 | Invalid TLS account format |
| 70106 | Invalid account format type |
| 70107 | userId is not registered |
| 70113 | Invalid batch quantity |
| 70114 | Restricted for security reasons |
| 70115 | uin does not match the developer uin for the sdkAppId |
| 70140 | sdkAppId and acctype mismatch |
| 70145 | Incorrect account type |
| 70169 | Internal error. Retry or contact TLS support (QQ: 3268519604) |
| 70201-70203 | Internal error. Retry or contact TLS support (QQ: 3268519604) |
| 70204 | sdkAppId has no corresponding acctype |
| 70205 | Failed to find acctype. Retry |
| 70206 | Invalid batch quantity in request |
| 70207-70208 | Internal error. Retry |
| 70209 | Failed to obtain developer uin flag |
| 70210 | uin in request is not a developer uin |
| 70211 | uin in request is invalid |
| 70212-70213 | Internal error. Retry or contact TLS support (QQ: 3268519604) |
| 70214 | Failed to verify internal ticket |
| 70221 | Invalid login status. Re-authenticate with userSig |
| 70222 | Internal error. Retry |
| 70225 | Internal error. Retry or contact TLS support (QQ: 3268519604) |
| 70231 | Internal error. Retry or contact TLS support (QQ: 3268519604) |
| 70236 | Failed to verify user signature |
| 70308 | Internal error. Retry or contact TLS support (QQ: 3268519604) |
| 70346 | Ticket verification failed |
| 70347 | Ticket verification failed (expired) |
| 70348 | Internal error. Retry or contact TLS support (QQ: 3268519604) |
| 70362 | Internal timeout. Retry or contact TLS support (QQ: 3268519604) |
| 70401 | Internal error. Retry |
| 70402 | Invalid parameter. Check required fields and protocol requirements |
| 70403 | Initiator is not an App administrator and lacks permission |
| 70050 | Rate limited due to too many failed retries. Verify the ticket and retry in 1 minute |
| 70051 | Account has been blacklisted. Contact TLS support (QQ: 3268519604) |
(static) OPERATION_FAILED
- Default Value:
-
- 5500
Description: Unrecoverable exception after SDK retries, typically caused by browser or network issues.
Affected APIs: enterRoom, startLocalVideo, startLocalAudio, startScreenShare, startRemoteVideo, switchRole
Handling suggestions:
- Verify that the required domain names and ports are accessible in your network environment. See Handle Firewall Restriction
- For other issues, contact us on Telegram
| extraCode | Description |
|---|---|
| 5501 | Firewall restriction: SDK cannot establish a media connection after retries, causing publish/subscribe to fail. See Handle Firewall Restriction |
| 5502 | Re-enter room failed: After 30s+ of network outage, SDK tried to re-enter but failed (likely due to expired userSig). Use the latest userSig to call TRTC.enterRoom again |
| 5503 | Error in business event callback. Check your callback function logic |
| 5505 | Video encoding failed (device may not support H264). Submit a Web SDK Capability Request to enable VP8 encoding |
| 5506 | Audio encoding failed. Upgrade to the latest SDK version, or prompt the user to update their system |
| 5507 | Video decoding failed. See the solution for 5505 |
| 5508 | Audio decoding failed. Upgrade to the latest SDK version, or prompt the user to update their system |
(static) OPERATION_ABORT
- Default Value:
-
- 5998
Description: API execution was aborted. This occurs when an API is called or re-called without meeting its lifecycle requirements (e.g. calling enterRoom or startLocalXxx continuously, or calling exitRoom before entering the room).
Affected APIs: enterRoom, startLocalVideo, startLocalAudio, startScreenShare, startRemoteVideo, switchRole
Handling suggestion: You can safely ignore this error code, as the SDK handles it without side effects. Optionally, use it to suppress unnecessary calls in your business logic.
(static) UNKNOWN_ERROR
- Default Value:
-
- 5999
Description: Unknown or undefined error
Handling suggestion: Contact us on Telegram