MessageLockLost Azure Origin: Platform & cloud OSI layer 7 · Application Last updated 2 Dec 2026

Azure Service Bus: MessageLockLostException — The lock supplied is invalid. Either the lock expired, or the message has already been removed from the queue

A message was completed or abandoned after its lock expired.

Exact message you may see The lock supplied is invalid. Either the lock expiredService Bus lock lost
Seen on: Azure

Meaning

In peek-lock mode a message is locked for a limited time (default 30 seconds up to 5 minutes). Slow processing lets the lock lapse so the message becomes visible again and the late Complete fails.

Common causes

  • Processing longer than the lock duration
  • Lock not renewed
  • Message already completed or dead-lettered
  • Connection dropped

⚡ Quick fix

  1. Enable automatic lock renewal (MaxAutoLockRenewalDuration)
  2. Increase the lock duration on the queue
  3. Make handlers idempotent since messages can be redelivered

Detailed fix by platform

.NET

  1. new ServiceBusProcessorOptions { MaxAutoLockRenewalDuration = TimeSpan.FromMinutes(10) }

How to diagnose

  1. Time — Processing vs lock?
  2. Renew — Auto renewal?
  3. Idempotent — Duplicates handled?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.