Skip to content

fix(s3): preserve delete bucket conflict codes#163

Merged
overtrue merged 1 commit intomainfrom
codex/fix-issue-160-delete-bucket-error
Apr 29, 2026
Merged

fix(s3): preserve delete bucket conflict codes#163
overtrue merged 1 commit intomainfrom
codex/fix-issue-160-delete-bucket-error

Conversation

@overtrue
Copy link
Copy Markdown
Contributor

Summary

Fixes #160.

This change preserves the S3 service error code when DeleteBucket fails, so rc rb can keep reporting bucket-specific failures instead of collapsing them into a generic network error.

Root cause

crates/s3/src/client.rs was converting DeleteBucket failures with e.to_string(), which drops RustFS/AWS-compatible error codes such as BucketNotEmpty from the CLI-facing path.

Solution

  • format DeleteBucket failures with the existing SDK-aware formatter
  • map BucketNotEmpty to Error::Conflict
  • keep NoSuchBucket mapped to Error::NotFound
  • add regression tests for both mappings

Verification

  • make pre-commit
  • manual check against rustfs/rustfs:latest
  • reproduced rc rb local/<bucket> on a non-empty bucket and confirmed exit code 6 with Bucket '<alias>/<bucket>' is not empty. Use --force to delete all objects first.

Risk

N/A

@overtrue overtrue merged commit 909b3c4 into main Apr 29, 2026
15 checks passed
@overtrue overtrue deleted the codex/fix-issue-160-delete-bucket-error branch April 29, 2026 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error message

1 participant