409 cloud protocol_error ai_generated true

409 冲突:Blob 'container/blob.txt' 当前有租约。请求中未指定租约 ID。

409 Conflict: There is currently a lease on the blob 'container/blob.txt'. No lease ID was specified in the request.

ID: cloud/azure-storage-blob-lease-conflict-while-deleting

其他格式: JSON · Markdown 中文 · English
92%修复率
86%置信度
1证据数
2023-07-20首次发现

版本兼容性

版本状态引入弃用备注
azure_cli active
storage_sdk active
blob_service active

根因分析

Blob 具有活动租约(例如,无限期或有限期),必须在删除请求中释放或指定租约 ID,但操作尝试删除时未提供租约 ID。

English

The blob has an active lease (e.g., infinite or finite) that must be released or specified in the delete request, but the operation attempted to delete without providing the lease ID.

generic

官方文档

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

解决方案

  1. Break the lease first using Azure CLI: `az storage blob lease break --account-name mystorageaccount --container-name container --name blob.txt --lease-break-period 30`. Then delete: `az storage blob delete --account-name mystorageaccount --container-name container --name blob.txt`
  2. In code (Python SDK), get the lease ID and delete: `from azure.storage.blob import BlobClient; blob = BlobClient.from_connection_string(conn_str, container_name="container", blob_name="blob.txt"); lease = blob.acquire_lease(); blob.delete_blob(lease=lease)`

无效尝试

常见但无效的做法:

  1. 80% 失败

    If the lease is infinite (never expires), waiting won't help; you must break it explicitly.

  2. 90% 失败

    The portal also requires lease ID for leased blobs; it will show the same error.