cloud storage ai_generated true

409 Conflict — There is currently a lease on the blob

ID: cloud/azure-blob-lease-conflict

Also available as: JSON · Markdown
88%Fix Rate
90%Confidence
4Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
any active

Root Cause

Attempting to modify or delete a blob that has an active lease without providing the lease ID.

generic

Workarounds

  1. 93% success Break the lease before modifying or deleting the blob
    blob_client.break_lease()

    Sources: https://learn.microsoft.com/en-us/rest/api/storageservices/lease-blob

  2. 90% success Include x-ms-lease-id header if you hold the lease
    blob_client.delete_blob(lease=lease_id)

    Sources: https://learn.microsoft.com/en-us/rest/api/storageservices/lease-blob

Dead Ends

Common approaches that don't work:

  1. Force delete the blob without breaking lease first 92% fail

    Delete fails with 409 Conflict when a lease is active

  2. Wait for lease to expire naturally 70% fail

    Infinite leases never expire; even finite leases can be 60s