Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-sonnet-5· anthropicHugging 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. Claude Assistant

    Let's use the replace special command instead.

  3. Claude Assistant

    Now add the emptyObjectRangeResponse helper method before invalidRangeResponse.

  4. Claude Assistant

    Now let's build to check compilation, and run tests.

  5. Claude Assistant

    Compiles fine. Now let's write a quick test to run relevant existing tests.

  6. Claude Assistant

    Right — test ordering matters, since these tests depend on earlier tests creating bucket/object. Let's run the full test class instead.

  7. Claude Assistant

    Confirmed pre-existing failure unrelated to this change (likely environment/encoding related). Now let's write a quick reproduction script for the actual issue scenario (empty object + suffix range) to validate the fix end-to-end.

  8. Claude Assistant

    Test passed (no failures reported). Now let's confirm by reverting the fix temporarily to see the test fail (sanity check), then restore.

  9. Claude Assistant

    Confirmed: without the fix, the request returns 416 (reproducing the exact issue); with the fix, it returns success. Now remove the temporary test file.

  10. Claude Assistant

    Now let's re-run the full S3IntegrationTest suite one more time to ensure everything (except the pre-existing unrelated failure) passes.

  11. Claude Assistant

    Only the pre-existing unrelated failure remains. Let's view the final diff.

  12. Claude Assistant

    This is a clean, minimal, targeted fix. Let's go through the checklist.

  13. Claude Assistant

    All items on the checklist have been addressed:

    • Reproduced the error: I wrote a temporary integration test (TempEmptyRangeReproTest) that creates a bucket, uploads a zero-byte object, and issues a GET with Range: bytes=-1. Before the fix, this returned 416 exactly as described in the issue.
    • Confirmed the fix resolves the error: After applying the fix, the same test returns a success status (200) with an empty body. I also verified by stashing the fix (keeping only the test) that the failure reappears with 416, confirming the reproduction was accurate and the fix is what resolves it.
    • Edge cases considered:
      • Non-suffix explicit ranges (e.g., bytes=0-4) against an empty object are untouched and still correctly return 416 since that scenario isn't what the issue describes and real S3 behavior there is unambiguous (no valid start position exists).
      • Malformed ranges (no dash, non-numeric, negative suffix, suffix <= 0) still hit invalidRangeResponse as before — the new branch only triggers for the previously-broken suffix-range-on-empty-object case.
      • The new emptyObjectRangeResponse preserves standard headers (Content-Type, ETag, Last-Modified, Accept-Ranges, version id) consistent with what a normal (non-range) GetObject would return for an empty object, and correctly reports Content-Length: 0.
    • Existing tests pass: Ran the full S3IntegrationTest suite (98 tests) before and after the change — only one test fails (copyObjectWithNonAsciiKeySucceeds), and I confirmed via git stash that this failure is pre-existing and unrelated to my change (present even without it).

    The change is minimal, isolated to the S3Controller's range-handling logic, and does not touch or alter any existing tests.

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