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

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

  • View the return value of the API operation.
  • View logs by calling the callback function in the SDK.

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

MQTT-specific error codes

Error code value Description
STATE_MQTT_CONNACK_RCODE_SERVER_UNAVAILABLE -0x0303 The MQTT server rejects the connection, and the service is unavailable. Try again later or Submit a ticket.
STATE_MQTT_CONNACK_RCODE_BAD_USERNAME_PASSWORD -0x0304 The username or password is invalid. Submit a ticket.
STATE_MQTT_CONNACK_RCODE_NOT_AUTHORIZED -0x0305 The MQTT server fails to authenticate the client because the password is invalid. Check whether the device authentication information is valid.

HTTPS-specific error codes

Error code value Description
STATE_HTTP_STATUS_LINE_INVALID -0x0401 The system fails to parse a valid status code from the received HTTPS message. The StatusCode parameter cannot be obtained. Submit a ticket.
STATE_HTTP_READ_BODY_FINISHED -0x0402 When the system parses the received HTTPS message, the message body is obtained but no more data is available. Submit a ticket.
STATE_HTTP_AUTH_CODE_FAILED -0x0404 The returned HTTPS status code is not 200 and the authentication fails. Check whether the signature is valid.
STATE_HTTP_AUTH_NOT_FINISHED -0x0405 The HTTPS response is not received and the authentication fails. Submit a ticket.
STATE_HTTP_AUTH_TOKEN_FAILED -0x0406 The system does not parse the token from the HTTPS response and the authentication fails. Submit a ticket.

Network-specific error codes

Error code value Description
STATE_PORT_NETWORK_DNS_FAILED -0x0F05 The system fails to resolve the TCP domain name. Check whether the domain name or IP address is valid.
STATE_PORT_NETWORK_CONNECT_FAILED -0x0F0C The TCP connection is not established. Submit a ticket.
STATE_PORT_TLS_INVALID_MAX_FRAGMENT -0x0F0B The maximum length of a TLS message cannot be set to 0. Check and modify the settings.
STATE_PORT_TLS_INVALID_SERVER_CERT -0x0F14 The TLS server certificate is invalid. Check the server certificate.
STATE_PORT_TLS_INVALID_CLIENT_CERT -0x0F15 The TLS client certificate is invalid. Check the client certificate.
STATE_PORT_TLS_INVALID_CLIENT_KEY -0x0F16 The TLS client key is invalid. Check the client key.
STATE_PORT_TLS_DNS_FAILED -0x0F17 The system fails to resolve the TCP domain name. Check whether the domain name or IP address is valid.
STATE_PORT_TLS_SOCKET_CREATE_FAILED -0x0F18 The TLS socket fails to be created. Submit a ticket.
STATE_PORT_TLS_SOCKET_CONNECT_FAILED -0x0F19 The connection that is established by using the TLS socket fails. Submit a ticket.
STATE_PORT_TLS_INVALID_RECORD -0x0F1A The received SSL message is invalid. Check whether the size of the TLS frame is too small.