Fix 412 Error on GCS Bucket Relocation: Disable Managed Prefixes

Overview

When relocating a Cloud Storage bucket, you may encounter a 412 error:

gcloud storage buckets relocate gs://mybucket --location=europe-west6 --dry-run
ERROR: (gcloud.storage.buckets.relocate) HTTPError 412: Bucket has incompatible features: Managed Prefixes must be disabled

This error occurs because Managed Folders are enabled on your bucket.

Solution

List managed folders in your bucket:

gcloud storage managed-folders list gs://my-bucket/

To relocate your bucket, you must disable Managed Prefixes as indicated by the error message. Once disabled, you can proceed with the relocation.