Skip to content

How can I delete a file in the bucket that has default_event_based_hold set to true? #4046

Closed

Description

@SiriIO

How can I delete a file in the bucket that has default_event_based_hold set to true?

Is there any method available to remove the hold before deleting

is under active Event-Based hold and cannot be deleted, overwritten or archived until hold is removed

Activity

  1. added
    type: questionRequest for information or clarification. Not an issue.
    priority: p3Desirable enhancement or fix. May not be included in next release.
    on Dec 11, 2025
  2. coryan commented on Dec 11, 2025

    @coryan
    Contributor

    I am a bit hazy on event holds, you may want to double check the documentation:

    https://docs.cloud.google.com/storage/docs/object-holds

    If I read that correctly, you first need to remove the hold and then remove the object. This may help:

    let updated = client
    .update_object()
    .set_if_metageneration_match(metageneration)
    .set_object(object.set_event_based_hold(false))
    .set_update_mask(FieldMask::default().set_paths(["event_based_hold"]))
    .send()
    .await?;
    println!(
    "successfully released event_based hold on object {NAME} in bucket {bucket_id}: {updated:?}"
    );

  3. locked and limited conversation to collaborators on Dec 11, 2025
  4. converted this issue into a discussion #4047 on Dec 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: storageIssues related to the Cloud Storage API.priority: p3Desirable enhancement or fix. May not be included in next release.type: questionRequest for information or clarification. Not an issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions