TRTC SDK v5.0 defines 8 types of error codes, and handles them through the RtcError object.
- See:
Example
// Usage:
// 1. API call error
trtc.startLocalVideo().catch(error => {
if (error.code === TRTC.ERROR_CODE.DEVICE_ERROR) {}
});
// 2. Non-API call error, the error that the 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 | The required parameter is not passed in |
5002 | The parameter type is incorrect |
5003 | The parameter is empty |
5004 | The parameter instance is incorrect |
5005 | The parameter value is out of range |
5006 | The parameter value is less than 0 |
5007 | The parameter value is less than the minimum value |
5008 | The parameter value is greater than the maximum value |
5009 | The elementId cannot be found on the page or was not found on the page when searching |
5010 | The parameter passed in is not of type HTMLElement |
5011 | streamId does not meet the specifications |
5012 | The range of the incoming roomId does not comply with the specifications [1, 4294967294] |
5013 | The strRoomId type passed in is not a legal string |
5014 | When the userId is not '*', a streamType needs to be passed in |
5015 | roomId or strRoomId not passed in, one of them must be passed in |
5016 | roomId must be a numeric type. Currently, a string type has been passed in. If you need to use a string as the room id, please use strRoomId |
5017 | The size of arraybuffer cannot be empty. Thrown from TRTC.sendSEIMessage, TRTC.sendCustomMessage |
5018 | The arraybuffer is oversize. Thrown from TRTC.sendSEIMessage, TRTC.sendCustomMessage |
(static) INVALID_OPERATION
- Default Value:
-
- 5100
Description: The prerequisite requirements of the API are not met when calling the interface.
Handling suggestion: Please check whether the calling logic complies with the API prerequisite requirements according to the corresponding API document. For example: 1. Switching roles before entering the room successfully, 2. The remote user and stream being played do not exist.
extraCode | Description |
---|---|
5101 | The API is called without entering the room, such as startRemoteVideo muteRemoteAudio switchRole and other APIs need to be called after entering the room |
5102 | The remote user does not exist, for example, when startRemoteVideo is called, the userId passed in corresponds to a remote user who is not in the room. |
5103 | The remote stream type does not exist, for example, when startRemoteVideo is called, streamType = TRTC.TYPE.STREAM_TYPE.SUB is passed in, but the corresponding remote user does not share the screen. |
5104 | Repeatedly calling the API, for example, after entering the room successfully, enterRoom interface is called again. |
5105 | Calling the API without the camera being enabled. For example, virtual background plugins require the camera to be enabled for use. |
5106 | Calling the API without the microphone being enabled. For example, AI noise reduction plugins require the microphone to be enabled for use. |
5107 | Role TRTC.TYPE.ROLE_AUDIENCE cannot call this api. |
5108 | You should enable SEI by TRTC.create({ enableSEI: true }) |
5109 | You need to publish video before sendSEIMessage |
(static) ENV_NOT_SUPPORTED
- Default Value:
-
- 5200
Description: The current environment does not support this function, indicating that the current browser does not support calling the corresponding API.
Handling suggestion: Usually, TRTC.isSupported can be used to perceive which capabilities the current browser supports. If the browser does not support it, you need to guide the user to use a browser that supports this capability. Reference: Check Environment and Device Before Calls
extraCode | Description |
---|---|
5201 | The current page protocol is not HTTPS, and the audio and video capture (pushing, linking) capabilities are not supported |
5202 | The current browser does not support WebRTC capabilities, the browser version is too low, or |
5203 | The browser does not support H264 encoding capability |
5204 | The browser does not support H264 decoding capability |
5205 | The browser does not support screen sharing capability |
5206 | The browser does not support small stream encoding capability |
5207 | The browser does not support SEI receiving and sending capabilities |
5208 | The browser does not support WebGL. |
5209 | The current version of the browser does not support this feature. Please upgrade to the latest version. |
5210 | The current version of the browser 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.
The following API will throw this error code when an exception occurs: trtc.startLocalAudio trtc.startLocalVideo trtc.startScreenShare
Suggestion: Guide the user to check whether the device has a camera and microphone, whether the system has authorized the browser, and whether the browser has authorized the page. It is recommended to increase the device detection process before entering the room to confirm whether the microphone and camera exist and can be captured normally before proceeding to the next call operation. Usually, this exception can be avoided after the device check. Check Environment and Device Before Calls
If you need to distinguish more detailed exception categories, you can process according to the following extraCode:
extraCode | Description |
---|---|
5301 | NotFoundError(DOMException) thrown by the browser Reason: The media device type that meets the request parameters cannot be found (including: audio, video, screen sharing). For example: The PC does not have a camera, but the browser is requested to obtain a video stream, which will report this error. Suggestion: It is recommended to guide users to check the camera or microphone and other external devices required for the call before the call. |
5302 | NotAllowedError(DOMException) thrown by the browser Reason: Suggestion: |
5303 | NotReadableError(DOMException) thrown by the browser Reason: Although the user has authorized the use of the corresponding device, due to errors that occurred on some hardware, browser, or webpage levels on the operating system, or other applications occupying the device, the device cannot be accessed by the browser. Suggestion: Handle according to the browser's error message, and prompt the user: "Unable to access the camera/microphone temporarily, please ensure that there are no other applications requesting access to the camera/microphone, and try again" |
5303 | NotReadableError(DOMException) thrown by the browser Reason: Although the user has authorized the use of the corresponding device, due to errors that occurred on some hardware, browser, or webpage levels on the operating system, or other applications occupying the device, the device cannot be accessed by the browser. Suggestion: 1-If this problem occurs with Windows Camera, the user will be directed to check whether the device is occupied. Only the camera of Windows system will be exclusive, but the microphone will not be exclusive. 2-If this error occurs with the microphone and camera of other systems, the user will be directed to check whether the device is normal or try to restart the browser. |
5304 | OverconstrainedError(DOMException) thrown by the browser Reason: The value of the cameraId/microphoneId parameter is invalid Suggestion: Check whether cameraId/microphoneId is the value returned by the device information acquisition interface |
5305 | InvalidStateError(DOMException) thrown by the browser Reason: The current page has not generated interaction, and the page is not fully activated Suggestion: It is recommended to turn on the camera and microphone after the user has clicked on the page to generate interaction |
5306 | SecurityError(DOMException) thrown by the browser Reason: The system security policy prohibits the use of the device Suggestion: Check whether the system restricts the use of the device, and recommend turning on the camera and microphone after the user clicks on the page to generate interaction |
5307 | AbortError(DOMException) thrown by the browser Reason: The device cannot be used due to some unknown reasons Suggestion: It is recommended to replace the device or browser, and recheck whether the device is normal |
5308 | Camera capture exception, after SDK retry, the capture cannot be restored. Reason: Camera exception or the user manually closes the capture permission of the browser Suggestion: Prompt the user that the camera capture is abnormal, and guide the user to check whether the camera is normal and whether there is a capture permission |
5309 | Microphone capture exception, after SDK retry, the capture cannot be restored. Reason: Microphone exception or the user manually closes the capture permission of the browser Suggestion: Prompt the user that the microphone capture is abnormal, and guide the user to check whether the microphone is normal and whether there is a capture permission |
Reference: getUserMedia exception and getDisplayMedia exception
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) {
// 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: This error code is thrown when abnormal data is returned from the server.
The following interfaces will throw this error code when an exception occurs: enterRoom
, startLocalVideo
, startLocalAudio
, startScreenShare
, startRemoteVideo
, switchRole
Handling suggestion: Server exceptions are usually handled during development. Common exceptions include: expired userSig, Tencent Cloud account arrears, TRTC service not enabled, etc. The server returns abnormal data for the following reasons.
extraCode | Description |
---|---|
5401 | The feature requires a purchase of a package. |
-8 | Incorrect sdkAppId, please check if sdkAppId is correctly filled in |
-10012 | roomId is not passed in or roomId does not meet the specifications. If you need to use the string type roomId, please use strRoomId instead when calling trtc.enterRoom |
-10015 | Failed to obtain server node |
-10016 | Server internal communication timeout, timeout is 3s |
-100006 | Failed to check permissions. After enabling advanced permission control, please check whether the privateMapKey parameter carried by enterRoom is correct. Please see Enable advanced permission settings |
-100013 | Customer service arrears, please log in to the TRTC Console, click the application you created, click [Account Information], and you can confirm the service status in the account information panel |
-100021 | Server overload, failed to enter the room |
-100022 | Server allocation failed |
-100024 | Failed to enter the room due to TRTC service not enabled. Please go to the IM Console to enable TRTC service for your application |
-102006 | Flow control defined error code (add user failed) |
-102010 | After enabling advanced permission control, the user does not have the permission to create a room. Please see Enable advanced permission settings |
-102023 | Request parameter error (request parameter error generated by the backend interface service) |
70001 | userSig expired, please try to regenerate. If it expires just after generation, please check whether the validity period is too small or mistakenly filled in as 0 |
70002 | userSig length is 0, please confirm whether the signature calculation is correct, access sign_src to get the idiotic source code of the calculation signature, check the parameters, and ensure the correctness of the signature calculation |
70003 | userSig verification failed, please confirm whether the userSig content is truncated, such as content truncation caused by insufficient buffer length |
70004 | userSig verification failed, please confirm whether the userSig content is truncated, such as content truncation caused by insufficient buffer length |
70005 | userSig verification failed, use tools to verify whether the generated userSig is correct |
70006 | userSig verification failed, use tools to verify whether the generated userSig is correct |
70007 | userSig verification failed, use tools to verify whether the generated userSig is correct |
70008 | userSig verification failed, use tools to verify whether the generated userSig is correct |
70009 | Failed to verify userSig with business public key, please confirm whether the userSig used for generation corresponds to the private key and sdkAppId |
70010 | userSig verification failed, use tools to verify whether the generated userSig is correct |
70013 | userId in userSig does not match the userId filled in when requesting, please check whether the userId filled in when logging in is consistent with that in userSig |
70014 | sdkAppId in userSig does not match the sdkAppId filled in when requesting, please check whether the sdkAppId filled in when logging in is consistent with that in userSig |
70015 | No verification method corresponding to the sdkAppId and account type was found. Please confirm whether the account integration operation has been performed |
70016 | The length of the pulled public key is 0. Please confirm whether the public key has been uploaded. If the public key is re-uploaded, please try again after ten minutes. |
70017 | Internal third-party ticket verification timed out. Please try again. If multiple retries are unsuccessful, please contact TLS account support, QQ: 3268519604. |
70018 | Internal verification of third-party tickets failed. |
70019 | The ticket field verified by HTTPS is empty. Please fill in userSig correctly. |
70020 | sdkAppId not found. Please confirm whether it has been configured on Tencent Cloud. |
70052 | userSig has expired. Please regenerate and try again. |
70101 | Request packet information is empty. |
70102 | Account type in request packet is incorrect. |
70103 | Phone number format is incorrect. |
70104 | Email format is incorrect. |
70105 | TLS account format is incorrect. |
70106 | Illegal account format type. |
70107 | userId is not registered. |
70113 | Batch quantity is invalid. |
70114 | Restricted for security reasons. |
70115 | uin is not the developer uin corresponding to sdkAppId. |
70140 | sdkAppId and acctype do not match. |
70145 | Account type is incorrect. |
70169 | Internal error. Please try again. If multiple retries are unsuccessful, please contact TLS account support, QQ: 3268519604. |
70201 | Internal error. Please try again. If multiple retries are unsuccessful, please contact TLS account support, QQ: 3268519604. |
70202 | Internal error. Please try again. If multiple retries are unsuccessful, please contact TLS account support, QQ: 3268519604. |
70203 | Internal error. Please try again. If multiple retries are unsuccessful, please contact TLS account support, QQ: 3268519604. |
70204 | sdkAppId does not have a corresponding acctype. |
70205 | Failed to find acctype. Please try again. |
70206 | Batch quantity in request is invalid. |
70207 | Internal error. Please try again. |
70208 | Internal error. Please try again. |
70209 | Failed to obtain developer uin flag. |
70210 | uin in request is not a developer uin. |
70211 | uin in request is illegal. |
70212 | Internal error. Please try again. If multiple retries are unsuccessful, please contact TLS account support, QQ: 3268519604. |
70213 | Failed to access internal data. Please try again. If multiple retries are unsuccessful, please contact TLS account support, QQ: 3268519604. |
70214 | Failed to verify internal ticket. |
70221 | Invalid login status, please re-authenticate with UserSig. |
70222 | Internal error, please try again. |
70225 | Internal error, please try again. If multiple retries are unsuccessful, please contact TLS account support, QQ: 3268519604. |
70231 | Internal error, please try again. If multiple retries are unsuccessful, please contact TLS account support, QQ: 3268519604. |
70236 | Failed to verify user signature. |
70308 | Internal error, please try again. If multiple retries are unsuccessful, please contact TLS account support, QQ: 3268519604. |
70346 | Ticket verification failed. |
70347 | Ticket verification failed due to expiration. |
70348 | Internal error, please try again. If multiple retries are unsuccessful, please contact TLS account support, QQ: 3268519604. |
70362 | Internal timeout, please try again. If multiple retries are unsuccessful, please contact TLS account support, QQ: 3268519604. |
70401 | Internal error, please try again. |
70402 | Invalid parameter. Please check if the required fields are filled in and if the filling meets the protocol requirements. |
70403 | The initiator is not an App administrator and does not have permission to operate. |
70050 | Limited due to failure and too many retries. Please check if the ticket is correct and try again in one minute. |
70051 | The account has been blacklisted. Please contact TLS account support, QQ: 3268519604. |
(static) OPERATION_FAILED
- Default Value:
-
- 5500
Description: The exception that the SDK cannot solve after multiple retries under the condition of meeting the API call requirements, usually caused by browser or network problems.
The following interfaces will throw this error code when an exception occurs: enterRoom
, startLocalVideo
, startLocalAudio
, startScreenShare
, startRemoteVideo
, switchRole
Handling suggestions:
- Confirm whether the domain name and port required for communication meet your network environment requirements, refer to the document Handle Firewall Restriction
- Other issues need to be handled by engineers. Contact us on telegram
extraCode | Description |
---|---|
5501 | Firewall restriction: After multiple retries, the SDK still cannot establish a media connection, which will cause streaming and pulling to fail. Handling suggestions: Refer to the tutorial Handle Firewall Restriction |
5502 | Re-entering the room failed: When the user experiences a network outage of more than 30s, the SDK will try to re-enter the room to restore the call, but the re-entry may fail due to the expiration of userSig, and this error will be thrown. Handling suggestions: When encountering this error, you can use the latest userSig to call TRTC.enterRoom to enter the room again |
5503 | Re-entering the room failed: When the user experiences a network outage of more than 30s, the SDK will try to re-enter the room to restore the call, but the re-entry may fail due to the expiration of userSig, and this error will be thrown. Handling suggestions: When encountering this error, you can use the latest userSig to call TRTC.enterRoom to enter the room again |
(static) OPERATION_ABORT
- Default Value:
-
- 5998
Description: The error code thrown when the API execution is aborted. When the API is called or repeatedly called without meeting the API lifecycle, the API will abort execution to avoid meaningless operations.
For example: Call enterRoom, startLocalXxx and other interfaces continuously, and call exitRoom without entering the room.
The following interfaces will throw this error code when an exception occurs: enterRoom
, startLocalVideo
, startLocalAudio
, startScreenShare
, startRemoteVideo
, switchRole
Handling suggestions: Capture and identify this error code, then avoid unnecessary calls in business logic, or you can do nothing, because the SDK has done side-effect-free processing, you only need to identify and ignore this error code when catching it.
(static) UNKNOWN_ERROR
- Default Value:
-
- 5999
Description: Unknown error or undefined error
Handling suggestions: Contact us on telegram