409 Conflict cloud protocol_error ai_generated true

There is currently a lease on the blob and no lease ID was specified in the request.

ID: cloud/azure-storage-blob-lease-expired-reason

Also available as: JSON · Markdown · 中文
88%Fix Rate
86%Confidence
1Evidence
2023-04-05First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Azure Storage REST API 2021-02-12 active
Azure SDK for .NET 12.18.0 active
AzCopy 10.21.0 active

Root Cause

An operation (e.g., delete or overwrite) was attempted on an Azure Storage blob that has an active lease, but the request did not include the required lease ID header.

generic

中文

尝试对具有活动租约的 Azure 存储 Blob 执行操作(例如删除或覆盖),但请求未包含所需的租约 ID 标头。

Official Documentation

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

Workarounds

  1. 90% success Include the lease ID in the request header: x-ms-lease-id: <lease-id>. Example using Azure CLI: az storage blob delete --account-name mystorageaccount --container-name mycontainer --name myblob --lease-id "<lease-id>"
    Include the lease ID in the request header: x-ms-lease-id: <lease-id>. Example using Azure CLI: az storage blob delete --account-name mystorageaccount --container-name mycontainer --name myblob --lease-id "<lease-id>"
  2. 85% success If the lease ID is unknown, first break the lease without specifying a lease ID by using a break period of 0 seconds: az storage blob lease break --account-name mystorageaccount --container-name mycontainer --name myblob --lease-break-period 0
    If the lease ID is unknown, first break the lease without specifying a lease ID by using a break period of 0 seconds: az storage blob lease break --account-name mystorageaccount --container-name mycontainer --name myblob --lease-break-period 0
  3. 80% success For automated workflows, acquire a new lease before performing the operation: az storage blob lease acquire --lease-duration 60 --account-name mystorageaccount --container-name mycontainer --name myblob
    For automated workflows, acquire a new lease before performing the operation: az storage blob lease acquire --lease-duration 60 --account-name mystorageaccount --container-name mycontainer --name myblob

中文步骤

  1. 在请求标头中包含租约 ID:x-ms-lease-id: <lease-id>。使用 Azure CLI 的示例:az storage blob delete --account-name mystorageaccount --container-name mycontainer --name myblob --lease-id "<lease-id>"
  2. 如果租约 ID 未知,请先通过使用 0 秒的租约中断期来中断租约,而无需指定租约 ID:az storage blob lease break --account-name mystorageaccount --container-name mycontainer --name myblob --lease-break-period 0
  3. 对于自动化工作流,在执行操作前获取新租约:az storage blob lease acquire --lease-duration 60 --account-name mystorageaccount --container-name mycontainer --name myblob

Dead Ends

Common approaches that don't work:

  1. 50% fail

    Breaking a lease requires knowing the lease ID or using a break period; another process may renew it.

  2. 80% fail

    The release action also requires the lease ID.