Skip to content

S3 Invalid Range 416 error when trying to read empty directory #1145

@jeet23

Description

@jeet23

The readFileMultipart API is unable to read files from an empty directory and errors out with an S3 exception.

Steps to reproduce:
Let's say we have a bucket localbucket has folder called directory but there is no files inside it.

val result = 
  s3.readFileMultipart(
          bucket = BucketName("localbucket"),  
          key = FileKey("localbucket/directory/"),
         partSize = PartSizeMB(25)
  )

Output:

Actual:


software.amazon.awssdk.services.s3.model.S3Exception: 
The requested range is not satisfiable (Service: S3, Status Code: 416, Request ID: xyz, 
Extended Request ID: ...

Expected:
Empty Stream with new Array[Byte](0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions