ErrorCode Enum

Definition

Error codes for common IoT hub response errors.

public enum ErrorCode
type ErrorCode = 
Public Enum ErrorCode
Inheritance
ErrorCode

Fields

Name Value Description
InvalidErrorCode 0

Used when the error code returned by the hub is unrecognized. If encountered, please report the issue so it can be added here.

InvalidProtocolVersion 400001

The API version used by the SDK is not supported by the IoT hub endpoint used in this connection.

Usually this would mean that the region of the hub doesn't yet support the API version. One should consider downgrading to a previous version of the SDK that uses an older API version, or use a hub in a region that supports it.

InvalidOperation 400003

The client has requested an operation that the hub recognizes as invalid. Check the error message for more information about what is invalid.

ArgumentInvalid 400004

Something in the request payload is invalid. Check the error message for more information about what is invalid.

ArgumentNull 400005

Something in the payload is unexpectedly null. Check the error message for more information about what is invalid.

IotHubFormatError 400006

Returned by the service if a JSON object provided by this library cannot be parsed, for instance, if the JSON provided for UpdateTwinAsync(String, Twin, String) is invalid.

DeviceDefinedMultipleTimes 400011

A devices with the same Id was present multiple times in the input request for bulk device registry operations.

For more information on bulk registry operations, see https://docs.microsoft.com/rest/api/iothub/service/bulk-registry/update-registry.

BulkRegistryOperationFailure 400013

An error was encountered processing bulk registry operations.

As this error is in the 4xx HTTP status code range, the service would have detected a problem with the job request or user input.

IotHubUnauthorizedAccess 401002

The SAS token has expired or IoT hub couldn't authenticate the authentication header, rule, or key. For more information, see https://docs.microsoft.com/azure/iot-hub/iot-hub-troubleshoot-error-401003-iothubunauthorized.

IotHubQuotaExceeded 403002

Total number of messages on the hub exceeded the allocated quota.

Increase units for this hub to increase the quota. For more information on quota, please refer to https://aka.ms/iothubthrottling.

DeviceMaximumQueueDepthExceeded 403004

The underlying cause is that the number of cloud-to-device messages enqueued for the device exceeds the queue limit.

You will need to receive and complete/reject the messages from the device-side before you can enqueue any additional messages. If you want to discard the currently enqueued messages, you can purge your device message queue. For more information on cloud-to-device message operations, see https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messages-c2d.

DeviceNotFound 404001

The operation failed because the device cannot be found by IoT hub.

The device is either not registered or disabled. May be thrown by operations such as GetDeviceAsync(String).

ModuleNotFound 404010

The operation failed because the module cannot be found by IoT hub.

The module is either not registered or disabled. May be thrown by operations such as GetModuleAsync(String, String).

DeviceAlreadyExists 409001

There's already a device with the same device Id in the IoT hub.

This can be returned on calling AddDeviceAsync(Device, CancellationToken) with a device that already exists in the IoT hub.

ModuleAlreadyExistsOnDevice 409301

The operation failed because it attempted to add a module to a device when that device already has a module registered to it with the same Id. This issue can be fixed by removing the existing module from the device first with RemoveModuleAsync(Module). This error code is only returned from methods like AddModuleAsync(Module, CancellationToken).

PreconditionFailed 412001

The ETag in the request does not match the ETag of the existing resource, as per RFC7232.

The ETag is a mechanism for protecting against the race conditions of multiple clients updating the same resource and overwriting each other. In order to get the up-to-date ETag for a twin, see GetTwinAsync(String, CancellationToken) or GetTwinAsync(String, String, CancellationToken).

MessageTooLarge 413001

When the message is too large for IoT hub you will receive this error.'

You should attempt to reduce your message size and send again. For more information on message sizes, see IoT hub quotas and throttling | Other limits

TooManyDevices 413002

Too many devices were included in the bulk operation.

Check the response for details. For more information, see https://docs.microsoft.com/rest/api/iothub/service/bulk-registry/update-registry.

ThrottlingException 429001

IoT hub throttling limits have been exceeded for the requested operation. For more information, IoT hub quotas and throttling.

ThrottleBacklogLimitExceeded 429002

IoT hub throttling limits have been exceeded for the requested operation.

For more information, see IoT hub quotas and throttling.

ServerError 500001

IoT hub ran into a server side issue.

There can be a number of causes for a 500xxx error response. In all cases, the issue is most likely transient. IoT hub nodes can occasionally experience transient faults. When your application tries to connect to a node that is having issues, you receive this error. To mitigate 500xxx errors, issue a retry from your application.

ServiceUnavailable 503001

IoT hub is currently unable to process the request. This is a transient, retryable error.

Applies to