You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 31, 2026. It is now read-only.
Unable to rewrite on top of an existing GCS blob in CMEK enabled bucket. Receives a 400 Bad Request with the following repro code. This looks very similar to #155
Environment details
python 3.9
google-cloud-storage 2.3.0
Steps to reproduce
Create a bucket with Customer-managed encryption keys (via Cloud KMS)
Expected behavior: Success, blob2 is overwritten
Actual behavior: google.api_core.exceptions.BadRequest: 400 POST <...> Bad Cloud KMS crypto key <...>
As long as blob1 and blob2 are not equal and both exist, this issue happens.
Workaround
Either delete blob2 first, then overwrite. OR call blob2 = bucket.blob(blob_name2) instead.
Potential Fix:
blob.rewrite() should only use kms_key_name if it doesn't end with a version.
Tracking issue for a customer.
Unable to rewrite on top of an existing GCS blob in CMEK enabled bucket. Receives a 400 Bad Request with the following repro code. This looks very similar to #155
Environment details
Steps to reproduce
Code example
Expected behavior: Success, blob2 is overwritten
Actual behavior: google.api_core.exceptions.BadRequest: 400 POST <...> Bad Cloud KMS crypto key <...>
As long as blob1 and blob2 are not equal and both exist, this issue happens.
Workaround
Either delete blob2 first, then overwrite. OR call
blob2 = bucket.blob(blob_name2)instead.Potential Fix:
blob.rewrite()should only usekms_key_nameif it doesn't end with a version.