Skip to content
TheChatArchiveThe Chat Archive
DeepSeekdeepseek/deepseek-v4-pro· deepseekHugging 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

    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. DeepSeek Assistant

    Let me start by understanding the issue:

    1. S3 GetObject with suffix range (e.g., bytes=-1) fails for empty objects
    2. The problem is in S3Controller.handleRangeRequest where for an empty object, it computes start = 0 and end = -1, then rejects the range
    3. Expected behavior: A suffix range request against an existing empty object should not fail the read - it should return an empty successful read.

    Let me explore the repository structure first and find the relevant code.

  3. DeepSeek Assistant

    Found the file. Let me look at the handleRangeRequest method:

  4. DeepSeek Assistant

    Let me open the file around line 613 to see the full method.

  5. DeepSeek Assistant

    Let me try again with the correct syntax.

  6. DeepSeek Assistant

    Now I can see the issue clearly. Let me trace through the logic for an empty object with bytes=-1:

    • totalSize = 0
    • before is empty, after = "1", so it goes to the suffix branch (line 629)
    • suffix = 1 (which is > 0, so it passes the check on line 631)
    • start = Math.max(0, 0 - 1) = 0
    • end = 0 - 1 = -1
    • Then on line 644: start >= totalSize → 0 >= 0 → true → returns 416 InvalidRange

    Let me create a reproduction script first to confirm the issue, then fix

  7. DeepSeek Assistant

    Let me also check the test files to understand the testing setup

  8. DeepSeek Assistant

    Let me search for range-related tests in the S3 integration test

  9. DeepSeek Assistant

    Now I understand the issue clearly. Let me look at the full handleRangeRequest method once more and then implement the fix:

  10. DeepSeek Assistant

    Now I have a clear picture. Let me implement the fix. The issue is that after computing start=0, end=-1 for an empty object, the validation on line 644 rejects the range because start >= totalSize (0 >= 0) or start > end (0 > -1).

    I need to add a special case: for empty objects, if the range request is syntactically valid and starts at byte 0 (suffix ranges or bytes=0-), we should return a 206 with empty body

  11. DeepSeek Assistant

    Now let me insert this code block after line 643 (end of try-catch) and before line 644 (the validation check

  12. DeepSeek Assistant

    The fix looks good. Let me now run the S3 integration tests to verify nothing is broken

  13. DeepSeek Assistant

    The one failure (copyObjectWithNonAsciiKeySucceeds) is a pre-existing issue unrelated to my change. Let me verify the range-related tests passed:

  14. DeepSeek Assistant

    Let me check the test results more carefully.

  15. DeepSeek Assistant

    97 out of 98 tests pass, and the only failure (copyObjectWithNonAsciiKeySucceeds) is pre-existing and unrelated to my change. All range-related tests pass.

    Let me also verify the fix handles the edge cases properly by reviewing the final code once more:

  16. DeepSeek Assistant

    The code looks correct. Let me verify the changes with git diff

  17. DeepSeek Assistant

    Let me also check the copy-source-range handling to ensure consistency - this is also a range-related path

  18. DeepSeek Assistant

    Let me check how copySourceRange is used in the copyObject

  19. DeepSeek Assistant

    Let me check the S3 service layer to see if there's any range logic there too

  20. DeepSeek Assistant

    Let me look at the copySourceRange handling in S3Service

  21. DeepSeek Assistant

    The copySourceRange in S3Service handles a different format (explicit START-END only, no suffix support). The issue is specifically about GetObject with suffix ranges, which my fix addresses.

    Let me also quickly verify the fix compiles correctly

  22. DeepSeek Assistant

    Compilation succeeds. Let me run just the range-related tests to confirm they all

  23. DeepSeek Assistant

    The test selection syntax might be wrong. Let me try running a single test to

  24. DeepSeek Assistant

    The individual test runs might have isolation issues. Let me run the full test class again

  25. DeepSeek Assistant

    The full test suite shows only 1 pre-existing failure. The individual test failures are due to test isolation issues (tests dependent on shared state from other tests). All range-related tests pass in the full suite.

    Let me write a quick script to verify the fix works for the exact scenario from the issue description

  26. DeepSeek Assistant

    Let me verify the surefire report to confirm range tests passed

  27. DeepSeek Assistant

    Let me verify the pre-existing failure isn't caused by my change. I'll stash and run the

  28. DeepSeek Assistant

    Confirmed: The 1 test failure (copyObjectWithNonAsciiKeySucceeds) is pre-existing and not caused by my change. Both with and without my fix, the exact same 98 tests run with 1 failure.

    Now let me verify the final state of the fix:

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