409 Conflict cloud protocol_error ai_generated true

Blob 上当前存在租约,且请求中未指定租约 ID。

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

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

版本兼容性

版本状态引入弃用备注
Azure Storage REST API 2021-02-12 active
Azure SDK for .NET 12.18.0 active
AzCopy 10.21.0 active

根因分析

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

English

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

官方文档

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

解决方案

  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

无效尝试

常见但无效的做法:

  1. 50% 失败

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

  2. 80% 失败

    The release action also requires the lease ID.