All Products
Search
Document Center

IoT Platform:Common error codes

Last Updated:Aug 21, 2023

This topic describes common errors that may occur when you configure Link SDK for C to connect devices to IoT Platform.

You can use the following methods to check the internal status and identify the cause when a connection fails.

  • View logs by calling the callback function in the SDK.

The following table describes common error codes. For the complete list of error codes, see aiot_state_api.h.

Error codes for MQTT connections

Error code

Description

STATE_MQTT_CONNACK_RCODE_SERVER_UNAVAILABLE

The Message Queuing Telemetry Transport (MQTT) server rejected the connection, and the service is unavailable. Try again later.

STATE_MQTT_CONNACK_RCODE_BAD_USERNAME_PASSWORD

The username or password is invalid.

STATE_MQTT_CONNACK_RCODE_NOT_AUTHORIZED

The MQTT server failed to authenticate the client because the password is invalid. Check whether the device authentication information is valid.

Error codes for HTTPS connections

Error code

Description

STATE_HTTP_STATUS_LINE_INVALID

The system failed to parse a valid status code from the received HTTPS message. The StatusCode parameter cannot be obtained.

STATE_HTTP_READ_BODY_FINISHED

When the system parses the received HTTPS message, the message body is obtained but no additional data is available.

STATE_HTTP_AUTH_CODE_FAILED

The returned HTTPS status code is not 200 and the authentication failed. Check whether the signature is valid.

STATE_HTTP_AUTH_NOT_FINISHED

The HTTPS response is not received and the authentication failed.

STATE_HTTP_AUTH_TOKEN_FAILED

The system failed to parse the token from the HTTPS response and the authentication failed.

Error codes for the network layer

Error code

Description

STATE_PORT_NETWORK_DNS_FAILED

The system failed to resolve the TCP domain name. Check whether the domain name or IP address is valid.

STATE_PORT_NETWORK_CONNECT_FAILED

The TCP connection failed to be established.

STATE_PORT_TLS_INVALID_MAX_FRAGMENT

The maximum length of a Transport Layer Security (TLS) message cannot be set to 0. Check and modify the settings.

STATE_PORT_TLS_INVALID_SERVER_CERT

The TLS server certificate is invalid. Check the server certificate.

STATE_PORT_TLS_INVALID_CLIENT_CERT

The TLS client certificate is invalid. Check the client certificate.

STATE_PORT_TLS_INVALID_CLIENT_KEY

The TLS client key is invalid. Check the client key.

STATE_PORT_TLS_DNS_FAILED

The system failed to resolve the TLS domain name. Check whether the domain name or IP address is valid.

STATE_PORT_TLS_SOCKET_CREATE_FAILED

The TLS socket failed to be created.

STATE_PORT_TLS_SOCKET_CONNECT_FAILED

The connection that is established by using the TLS socket failed.

STATE_PORT_TLS_INVALID_RECORD

The received SSL message is invalid. Check whether the size of the TLS frame is too small.