Skip to content

Error on empty bucket listing #722

@Z9n2JktHlZDmlhSvqc9X2MmL3BwQG7tk

Description

s5cmd finishes with error (exit code = 1) when listing empty bucket:

s5cmd ls s3://empty-bucket; echo exit_code=$?
ERROR "ls s3://empty-bucket": no object found
exit_code=1

The same exit code returns for non-existent buckets:

s5cmd ls s3://non-existent-bucket; echo exit_code=$?
ERROR "ls s3://non-existent-bucket": NotFound: Not Found status code: 404, request id: tx000000000000000000014-0066647b03-8d9195fc-default, host id:
exit_code=1

There is no way to differentiate empty and non-existent buckets.
I think it is better not to display any error and return 0 exit code.
For example: s3cmd works as expected:

s3cmd ls s3://empty-bucket; echo exit_code=$?
exit_code=0

s3cmd ls s3://non-existent-bucket; echo exit_code=$?
ERROR: Bucket 'non-existent-bucket' does not exist
ERROR: S3 error: 404 (NoSuchBucket)
exit_code=12

s5cmd version: 2.2.2

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions