409 cloud protocol_error ai_generated true

409 Conflict:您尝试删除的对象版本不是最新版本。

409 Conflict: The object version you are trying to delete is not the latest version.

ID: cloud/gcp-cloud-storage-bucket-object-versioning-conflict

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

版本兼容性

版本状态引入弃用备注
GCS JSON API v1 active
Google Cloud Storage Client Library 2.x active
gsutil 5.x active

根因分析

当存储桶启用版本控制时,删除非最新对象版本需要指定代次编号,否则Cloud Storage返回409冲突。

English

When bucket versioning is enabled, deleting a non-latest object version requires specifying the generation number; otherwise Cloud Storage returns a 409 conflict.

generic

官方文档

https://cloud.google.com/storage/docs/deleting-objects#delete-object-noncurrent

解决方案

  1. Use gsutil with generation number: `gsutil rm gs://bucket-name/object#<generation-number>`. To find generation numbers: `gsutil ls -la gs://bucket-name/object`.
  2. Delete all versions of an object: `gsutil rm -a gs://bucket-name/object` (the -a flag removes all versions).

无效尝试

常见但无效的做法:

  1. 95% 失败

    If bucket versioning is enabled, the API requires generation for deleting a specific version; the error persists.

  2. 70% 失败

    Disabling versioning does not delete existing versions; you must suspend versioning and then delete each version separately.

  3. 85% 失败

    gsutil rm without -a only deletes the live version; non-current versions remain and cause conflict errors.