Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This article describes the causes and solutions for 412002 DeviceMessageLockLost errors.
Symptoms
When trying to send a cloud-to-device message, the request fails with the error 412002 DeviceMessageLockLost.
Cause
When a device receives a cloud-to-device message from the queue (for example, using ReceiveAsync()) the message is locked by IoT Hub for a lock timeout duration of one minute. If the device tries to complete the message after the lock timeout expires, IoT Hub throws this exception.
Solution
If IoT Hub doesn't get the notification within the one-minute lock timeout duration, it sets the message back to Enqueued state. The device can attempt to receive the message again. To prevent the error from happening in the future, implement device side logic to complete the message within one minute of receiving the message. This one-minute time-out can't be changed.