Cannot remove bucket [name]. The bucket you tried to delete is not empty. You must delete all ...

Issue: When I want to delete a bucket, I get an error saying 'Cannot remove bucket [name]. The bucket you tried to delete is not empty. You must delete all versions in the bucket.' This occurs despite the bucket already being empty.

Resolution: Enable versioning in the bucket's properties and permanently delete all objects incl. their respective versions. Afterward, you may delete the bucket permanently.

Background: In versioning, you can add 'delete markers' to an object. This effectively hides the object as well as its previous versions. When you change that folder's settings and disable versioning, you can no longer show hidden files. While the bucket may appear empty, there are still objects hidden with a 'delete marker'.

Last updated