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
- Enable automatic lock renewal (
MaxAutoLockRenewalDuration) - Increase the lock duration on the queue
- Make handlers idempotent since messages can be redelivered
Detailed fix by platform
.NET
new ServiceBusProcessorOptions { MaxAutoLockRenewalDuration = TimeSpan.FromMinutes(10) }
How to diagnose
- Time — Processing vs lock?
- Renew — Auto renewal?
- 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:
Most viewed in Azure
- MissingSubscriptionRegistration MissingSubscriptionRegistration: The subscription is not registered to use namespace 'Microsoft.X'
- ScopeLocked ScopeLocked: The scope cannot perform write/delete operation because following scope(s) are locked
- AADSTS50053 AADSTS50053: Your account is locked (Smart Lockout) / sign-in blocked due to suspicious activity
Other ways to find it
🧠 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.
Did this fix work for you?
Report a correction or suggest an improvement
Last updated 2 Dec 2026