409
cloud
protocol_error
ai_generated
true
409 Conflict: The object version you are trying to delete is not the latest version.
ID: cloud/gcp-cloud-storage-bucket-object-versioning-conflict
95%Fix Rate
90%Confidence
1Evidence
2023-08-20First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| GCS JSON API v1 | active | — | — | — |
| Google Cloud Storage Client Library 2.x | active | — | — | — |
| gsutil 5.x | active | — | — | — |
Root Cause
When bucket versioning is enabled, deleting a non-latest object version requires specifying the generation number; otherwise Cloud Storage returns a 409 conflict.
generic中文
当存储桶启用版本控制时,删除非最新对象版本需要指定代次编号,否则Cloud Storage返回409冲突。
Official Documentation
https://cloud.google.com/storage/docs/deleting-objects#delete-object-noncurrentWorkarounds
-
95% success Use gsutil with generation number: `gsutil rm gs://bucket-name/object#<generation-number>`. To find generation numbers: `gsutil ls -la gs://bucket-name/object`.
Use gsutil with generation number: `gsutil rm gs://bucket-name/object#<generation-number>`. To find generation numbers: `gsutil ls -la gs://bucket-name/object`.
-
98% success Delete all versions of an object: `gsutil rm -a gs://bucket-name/object` (the -a flag removes all versions).
Delete all versions of an object: `gsutil rm -a gs://bucket-name/object` (the -a flag removes all versions).
中文步骤
Use gsutil with generation number: `gsutil rm gs://bucket-name/object#<generation-number>`. To find generation numbers: `gsutil ls -la gs://bucket-name/object`.
Delete all versions of an object: `gsutil rm -a gs://bucket-name/object` (the -a flag removes all versions).
Dead Ends
Common approaches that don't work:
-
95% fail
If bucket versioning is enabled, the API requires generation for deleting a specific version; the error persists.
-
70% fail
Disabling versioning does not delete existing versions; you must suspend versioning and then delete each version separately.
-
85% fail
gsutil rm without -a only deletes the live version; non-current versions remain and cause conflict errors.