All Products
Search
Document Center

IoT Platform:Common error codes

Last Updated:Jun 03, 2026

Lists common error codes returned by the C Link SDK when device connections fail, covering MQTT, HTTPS, and network layer errors.

When a connection fails, the Link SDK reports its internal status in two ways:

  • The API returns a status code, which is a non-positive integer of type int32_t. A value of 0 indicates success and other values indicate the runtime status.

    • Use the retval = aiot_xxx_yyy() format to retrieve the return value.

    • Each return value corresponds to a unique internal execution branch. For more information, see aiot_state_api.h or aiot_xxx_api.h.

    • The return value ranges for all components do not overlap. They are distributed within the range of 0x0000 to 0xFFFF.

  • The SDK calls your log callback function.

The following tables list common error codes. All codes are defined in aiot_state_api.h.

MQTT access

Error code

Description

STATE_MQTT_CONNACK_RCODE_SERVER_UNAVAILABLE

MQTT server denied the connection. Service unavailable. Retry later.

STATE_MQTT_CONNACK_RCODE_BAD_USERNAME_PASSWORD

Invalid username or password.

STATE_MQTT_CONNACK_RCODE_NOT_AUTHORIZED

MQTT server identity verification failed. Incorrect password. Verify the device authentication information.

HTTPS access

Error code

Description

STATE_HTTP_STATUS_LINE_INVALID

Invalid status line in the HTTPS response. The StatusCode could not be retrieved.

STATE_HTTP_READ_BODY_FINISHED

HTTPS message body fully received, but no further data is available.

STATE_HTTP_AUTH_CODE_FAILED

HTTPS authentication returned a non-200 status code. Verify the authentication signature.

STATE_HTTP_AUTH_NOT_FINISHED

Incomplete HTTPS authentication response. Authentication failed.

STATE_HTTP_AUTH_TOKEN_FAILED

Failed to parse the token from the HTTPS authentication response.

Network layer

Error code

Description

STATE_PORT_NETWORK_DNS_FAILED

TCP DNS resolution failed. Verify the domain name or IP address.

STATE_PORT_NETWORK_CONNECT_FAILED

Failed to establish a TCP connection.

STATE_PORT_TLS_INVALID_MAX_FRAGMENT

TLS maximum message length is set to 0, which is invalid. Reset the value.

STATE_PORT_TLS_INVALID_SERVER_CERT

Invalid TLS server certificate configuration. Verify the server certificate.

STATE_PORT_TLS_INVALID_CLIENT_CERT

Invalid TLS client certificate configuration. Verify the client certificate.

STATE_PORT_TLS_INVALID_CLIENT_KEY

Invalid TLS client key configuration. Verify the client key.

STATE_PORT_TLS_DNS_FAILED

TLS DNS resolution failed. Verify the domain name or IP address.

STATE_PORT_TLS_SOCKET_CREATE_FAILED

Failed to create the TLS socket.

STATE_PORT_TLS_SOCKET_CONNECT_FAILED

Failed to connect the TLS socket.

STATE_PORT_TLS_INVALID_RECORD

Invalid SSL packet received. Check whether the TLS frame data length is too small.