Troubleshoot and resolve issues during interactive messaging (IM) development and testing.
Enable local logging
Enable detailed SDK log output for analysis and troubleshooting. Set the log level in the SDK configuration during initialization, then view logs in your IDE or console.
Android
ImSdkConfig config = new ImSdkConfig();
config.logLevel = ImLogLevel.DEBUG; // Optional. Specify the minimum log level. The default is ImLogLevel.DEBUG. To disable logging, set it to ImLogLevel.NONE.
iOS
// Initialization
AliVCIMEngineConfig *config = [AliVCIMEngineConfig new];
config.logLevel = AliVCIMLogLevelDebug;
Web
const { ImEngine, ImLogLevel } = AliVCInteraction;
// Obtain the engine instance
const engine = ImEngine.createEngine();
try {
await engine.init({
deviceId: "deviceId", // Optional.
appId: "appId", // Required. Passing an empty value will return initialization failure code (-2). After creating your application, you must replace APP_ID in this example with actual AppId.
appSign: "appSign", // Required. Passing an empty value will return initialization failure code (-2). After creating your application, you must replace APP_SIGN in this example with actual AppSign.
logLevel: ImLogLevel.ERROR, //Optional. Specify the minimum log level. The default is ImLogLevel.DEBUG. To disable logging, set it to ImLogLevel.NONE.
});
} catch (error) {
// The error codes
// Values other than 0 indicate failed initialization. Specifically, the value 1001 indicates repeated initialization, the value 1002 indicates that the underlying engine failed to be created, the value -1 indicates repeated initialization of the underlying layer, and the value -2 indicates that the configuration information for initialization was invalid.
console.log(`Init Fail: code:${error.code}, message: ${error.msg}`);
}
WeChat mini program
// Import the SDK. The path depends on your project setup.
const { ImEngine, ImLogLevel } = import '../../lib/alivc-im.js';
// Obtain the engine instance.
const engine = ImEngine.createEngine();
try {
await engine.init({
deviceId: "deviceId", // Optional.
appId: "appId", // Required. Passing an empty value will return initialization failure code (-2). After creating your application, you must replace APP_ID in this example with your actual AppId.
appSign: "appSign", // Required. Passing an empty value will return initialization failure code (-2). After creating your application, you must replace APP_SIGN in this example with your actual AppSign.
logLevel: ImLogLevel.ERROR, // Optional. Specify the minimum log level. The default is ImLogLevel.DEBUG. To disable logging, set it to ImLogLevel.NONE.
// A function to locate the WebAssembly (.wasm) file.
locateFile: (url: string) => {
if (url.endsWith('.wasm')) {
// You must modify the return path to match the location of the `alivc-im.wasm.br` file in your project.
// This path is resolved from the project's root directory, not the current file's directory. Do not use relative paths like `../` or `./`.
// Example for uni-app project structure: '/static/mp-weixin/alivc-im.wasm.br'
// Example for Taro project structure: '/static/alivc-im.wasm.br'
return '/lib/alivc-im.wasm.br';
}
return url;
},
});
} catch (error) {
// The error codes
// Values other than 0 indicate failed initialization. Specifically, the value 1001 indicates repeated initialization, the value 1002 indicates that the underlying engine failed to be created, the value -1 indicates repeated initialization of the underlying layer, and the value -2 indicates that the configuration information for initialization was invalid.
console.log(`Init Fail: code:${error.code}, message: ${error.msg}`);
}
Log levels: DEBUG (most verbose), INFO, WARN, ERROR (least verbose), and NONE (no output).
-
Use DEBUG during development and testing.
-
Use INFO in production.
Error codes
|
Error code |
Cause |
Solution |
|
0/200 |
Success. |
Normal. |
|
-1 |
Engine already initialized. |
Operation:Initialization. Check if initialization has already been performed. |
|
-2 |
Invalid configuration information for initialization. |
Operation:Initialization. Verify that the initialization configuration is correct. For example, check whether appid or appsign is empty. |
|
1 |
Not initialized. |
Check if initialization has already been performed before proceeding. |
|
2 |
Invalid parameters. |
Verify input parameters. Check the error message for details. |
|
3 |
Status error. |
Verify the operation flow. Check the error message for details. |
|
4 |
Failed connection. |
For login: verify network connectivity and retry. For other operations: the connection is lost. Wait for reconnection, then retry. Monitor connection status to confirm reconnection. |
|
5 |
Connection timeout. |
Operation:Login. Verify network connectivity and retry. |
|
6 |
Failed to send. |
Verify network connectivity and retry. You can use the error message for further troubleshooting. |
|
7 |
Send canceled. |
Typically caused by a logout that interrupted a pending operation. Check the error message for details. |
|
8 |
Send timeout. |
Verify network connectivity and retry. |
|
9 |
Failed to subscribe. |
Operation:Joining a group or restoring group membership after reconnection. Verify network connectivity, exit the group, and rejoin. |
|
10 |
Disconnected from the subscribed channel. |
Operation:Joining a group or restoring group membership after reconnection. Verify network connectivity, exit the group, and rejoin. |
|
11 |
Subscription timeout. |
Operation:Joining a group or restoring group membership after reconnection. Verify network connectivity, exit the group, and rejoin. |
|
12 |
Failed to compress. |
Check local logs for issues such as out-of-memory errors, then retry. |
|
13 |
Failed to decompress. |
Check local logs for issues such as out-of-memory errors, then retry. |
|
14 |
Failed to encrypt. |
Check local logs for issues such as out-of-memory errors, then retry. |
|
15 |
Failed to decrypt. |
Check local logs for issues such as out-of-memory errors, then retry. |
|
16 |
Failed to encapsulate message body. |
Check local logs for issues such as out-of-memory errors, then retry. |
|
17 |
Failed to parse message body. |
Check local logs for issues such as out-of-memory errors, then retry. |
|
18 |
Data is empty. |
Operation:Initialization. Verify that the appsign for initialization is valid. |
|
19 |
Data error. |
Operation:Initialization. Verify that the appsign for initialization is valid. |
|
20 |
Address error. |
Operation:Initialization. Verify that the appsign is valid. Check for leading spaces or truncated content. |
|
21 |
Connection canceled. |
Operation:Login. During login connection, a logout operation was executed, interrupting the previous login. |
|
304 |
Repeated login or repeated joinGroup when already in a group. |
|
|
400 |
Parameter error. Parameters cannot be parsed. |
Verify that input parameters meet the specifications. For example, IDs such as appid, userid, and groupid allow a maximum of 64 characters containing only letters, digits, and hyphens (-). |
|
402 |
Authentication failed during login |
Verify that the login token generation parameters match the login parameters. |
|
403 |
No permission for the operation. Or the login token has expired. |
Verify input information. For example, check whether the login token has expired or a non-admin user is calling an admin-only API. |
|
404 |
No session. A network change caused a connection switch, and the server cannot process messages on the new connection. A reconnect signal is needed. |
The SDK reconnects automatically. Wait for reconnection before retrying. Monitor connection status to confirm. |
|
406 |
Security review failed. |
Verify that the content moderation feature is enabled and the content meets moderation standards. |
|
407 |
The number of created groups exceeds the limit. |
Verify that the group creation limit has not been exceeded. |
|
409 |
An unrecoverable error occurred during reconnection. |
Exit and try again. |
|
412 |
Busy, sending too fast. |
Try again later. |
|
413 |
Busy, sending too fast. |
Try again later. |
|
420 |
Large groups do not support querying the user list. |
Verify that it is a large group before calling this API. |
|
424 |
The recipient user is offline when sending a c2c message. |
Wait for the recipient to come online before proceeding with the operation. |
|
425 |
Not in the group. |
Join the group first before proceeding with the operation. |
|
429 |
Too many requests in a short period. For example, the same user logging in twice within 1 second. |
Retry later or add rate limiting to prevent rapid repeated calls. |
|
440 |
The group does not exist or has been deleted. |
Operations: Group join, message broadcast, group management, and other group operations. Verify that the group has not been deleted. |
|
441 |
The group has been deleted. |
Operations: Group join, message broadcast, group management, and other group operations. Verify that the group has not been deleted. |
|
442 |
Unable to send messages in this group. |
Verify that the user is not muted. |
|
443 |
Exceeded group membership limit or list size limit. |
Leave unused groups to free capacity. |
|
444 |
The number of group message types exceeds the limit of 30. |
Check and limit the number of message types. |
|
500 |
Temporary system error. |
Try again later. |
|
601 |
Status error. |
Check the error message to verify the operation flow. For example, "SDK not initialized" means you must initialize first. |
|
602 |
Not logged in. |
Verify that you have logged in before performing this operation. For example, you must log in before joining a group. |
|
603 |
Received a message from the previous login state. |
Verify that the operation flow meets expectations. |
|
604 |
Failed to parse data. |
Check local logs and the returned error message for details. |
|
1001 |
Repeated initialization. |
Operation:Initialization. Check if initialization has already been performed before proceeding. |
|
1002 |
Failed to create the underlying engine. |
Operation:Initialization. Restart the application and try again. |