Skip to content
TheChatArchiveThe Chat Archive
x-ai/grok-4.5· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION [BUG] S3 GetObject suffix range fails for empty objects Service S3 AWS…

  1. User

    ISSUE DESCRIPTION

    [BUG] S3 GetObject suffix range fails for empty objects

    Service

    S3

    AWS API Action

    GetObject with the Range header set to a suffix byte range, for example bytes=-1.

    Expected behavior

    A suffix range request against an existing empty object should not fail the read. This is exercised by Trino's S3 filesystem compatibility test for empty files, where TrinoInput.readTail(...) reads an existing zero-byte S3 object and expects an empty successful read.

    Actual behavior

    Floci returns 416 InvalidRange for the same request because S3Controller.handleRangeRequest computes start = 0 and end = -1 for an empty object, then rejects the range.

    In Trino's Floci-backed S3 filesystem test this surfaces as:

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

    Reproduction

    # Start Floci on localhost:4566 first.
    aws --endpoint-url http://localhost:4566 s3 mb s3://range-empty-repro
    printf '' > /tmp/empty-object
    aws --endpoint-url http://localhost:4566 s3 cp /tmp/empty-object s3://range-empty-repro/empty
    aws --endpoint-url http://localhost:4566 s3api get-object \
      --bucket range-empty-repro \
      --key empty \
      --range 'bytes=-1' \
      /tmp/range-empty-output
    

    Environment

    • Floci version / image tag: floci/floci:1.5.21
    • Java SDK version (if applicable): observed with Trino's AWS SDK v2 S3 client tests
    • How you're running Floci (Docker / native / mvn quarkus:dev): Docker via Testcontainers

    Interface

    No new interfaces are introduced.

    ADDITIONAL ADVICE

    Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use git checkout <file> to restore the file to its original state. You can also reset all changes in the repository using git reset --hard command. Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to get the changes that need to be submitted.

    CHECKLIST

    Before submitting your solution, please go over the following checklist and make sure you've done everything:

    • If an error was reported in the issue description, I have successfully reproduced it.
    • If an error was reported in the issue description, I have confirmed that my fix resolves the error.
    • I have thought about edge cases and made sure my fix handles them as well.
    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.

    Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!

    (Current directory: /floci, current file: none) bash-$

  2. Assistant

    I'll start by exploring the repository structure and locating the range-request handling code mentioned in the issue.

  3. Assistant

    I'll inspect handleRangeRequest and any related range-parsing logic next.

  4. Assistant

    rg is not available, let me use grep.

  5. Assistant

    Let me open the handleRangeRequest method.

  6. Assistant

    I'll check existing range-related tests and more commentary on empty-object range behavior.

  7. Assistant

    I'll check AWS-compatible behavior notes and related empty-object handling in the codebase.

  8. Assistant

    I'll look up real AWS/S3 empty-object suffix-range behavior and how other emulators handle it.

  9. Assistant

    Checking whether HEAD also implements Range handling and how the full getObject flow works.

  10. Assistant

    Implementing the fix: for empty objects, a valid suffix range should return the full empty object (200) instead of 416.

  11. Assistant

    Adding the helper method next to the other range helpers.

  12. Assistant

    Checking how empty objects store data and reviewing the surrounding tests.

  13. Assistant

    Checking empty-body handling and running the existing range tests.

  14. Assistant

    Setting HOME and re-running tests.

  15. Assistant

    Creating a temporary focused test to reproduce the bug and verify the fix.

  16. Assistant

    Confirming the pre-fix 416 behavior, then re-applying the fix.

  17. Assistant

    Reproducing the original failure without the fix using a shell-based approach.

  18. Assistant

    Bug reproduced (416). Re-running the fixed test, then related existing S3 tests.

  19. Assistant

    Checking whether range-related tests passed; the non-ASCII failure looks unrelated.

  20. Assistant

    Confirming range tests passed and cleaning up the temporary test file.

  21. Assistant

    Confirming empty-object data is a zero-length array, not null:

  22. Assistant

    Looking at S3Object constructor for null data (empty body from HTTP might be null):

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.