Skip to content
TheChatArchiveThe Chat Archive
MiniMaxminimax/minimax-m3· 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. MiniMax Assistant

    Let me start by exploring the repository structure to understand the codebase.

  3. MiniMax Assistant

    Let me explore the repository structure further.

  4. MiniMax Assistant

    Let me search for the relevant handleRangeRequest method.

  5. MiniMax Assistant

    Let me also look at the calling code and the context where the range header is parsed.

  6. MiniMax Assistant

    Let me look at the structure of the project and understand how to set up/build it.

  7. MiniMax Assistant

    Let me look at the tests in more detail to understand the existing testing infrastructure.

  8. MiniMax Assistant

    Let me look at the broader context of the S3 controller, particularly the getObject handler.

  9. MiniMax Assistant

    Let me look at how the test is set up to understand the testing infrastructure better.

  10. MiniMax Assistant

    Let me check if I can build and test the project first.

  11. MiniMax Assistant

    Let me try the tests first to check we have everything we need.

  12. MiniMax Assistant

    Let me check what S3Object looks like to understand how empty objects are stored.

  13. MiniMax Assistant

    Let me see the appendObjectHeaders method to understand the response building pattern.

  14. MiniMax Assistant

    Let me first reproduce the issue by running the existing tests to see the current state.

  15. MiniMax Assistant

    Let me check if there are existing tests on empty objects with Range.

  16. MiniMax Assistant

    Let me first build the project to make sure everything compiles before making changes.

  17. MiniMax Assistant

    The build succeeded. Let me try running a single S3 test to verify the test infrastructure works.

  18. MiniMax Assistant

    The test failed because it depends on previous tests. Let me run all the tests to set up properly.

  19. MiniMax Assistant

    Now I have a working test infrastructure. Let me create a small Java program to reproduce the bug first.

  20. MiniMax Assistant

    Let me check if I can create a temporary test that reproduces the bug without affecting the existing tests.

  21. MiniMax Assistant

    Let me write a temporary test file to reproduce the bug first.

  22. MiniMax Assistant

    I successfully reproduced the bug. The test fails with Expected status code <200> but was <416>. Now let me apply the fix.

  23. MiniMax Assistant

    Let me look at what helpers already exist for response building.

  24. MiniMax Assistant

    Let me look at the current code in getObject and handleRangeRequest carefully to design a clean refactor.

  25. MiniMax Assistant

    Let me search for any existing tests on empty objects that might be impacted.

  26. MiniMax Assistant

    Now let me make the fix. I'll refactor to extract a helper method, then add the early-return guard for empty objects.

  27. MiniMax Assistant

    Let me check how S3Object.size and S3Object.data are set.

  28. MiniMax Assistant

    Let me look at the S3Object constructor to see how size is set.

  29. MiniMax Assistant

    Let me trace through how getObject retrieves objects.

  30. MiniMax Assistant

    Now I have a complete understanding of the code. Let me apply the fix by refactoring handleRangeRequest and the getObject method to share response-building logic, and add the early-return guard for empty objects.

  31. MiniMax Assistant

    Let me apply the fix by extracting a helper method and adding the empty object handling.

  32. MiniMax Assistant

    Let me make the precise changes to the controller. First, let me check the exact context around the getObject response builder.

  33. MiniMax Assistant

    Let me make the change using the replace command to be safe.

  34. MiniMax Assistant

    Let me use perl for the replacement.

  35. MiniMax Assistant

    Let me verify the changes look correct.

  36. MiniMax Assistant

    Let me build and test the change.

  37. MiniMax Assistant

    The fix works! Let me extend the test to cover more edge cases.

  38. MiniMax Assistant

    All 4 edge case tests pass. Now let me run the existing S3 integration tests to make sure I haven't broken anything.

  39. MiniMax Assistant

    Only one test fails (copyObjectWithNonAsciiKeySucceeds), which was failing before my changes too. Let me verify by checking git diff.

  40. MiniMax Assistant

    Let me check that the copyObjectWithNonAsciiKeySucceeds was already failing before my changes.

  41. MiniMax Assistant

    Now let me run additional S3 tests to ensure I haven't broken anything.

  42. MiniMax Assistant

    The tests need to run in order (they depend on prior setup). Let me run the full S3IntegrationTest class.

  43. MiniMax Assistant

    Let me confirm this was a pre-existing failure by running with the original code.

  44. MiniMax Assistant

    Confirmed - copyObjectWithNonAsciiKeySucceeds fails before my changes too. Let me see the Range-related test results specifically.

  45. MiniMax Assistant

    All Range-related tests pass. Let me run a few more S3 tests to verify everything is fine.

  46. MiniMax Assistant

    All S3 tests pass except the pre-existing failure. Let me do a comprehensive review of my changes one more time.

  47. MiniMax Assistant

    Let me check if any other code references the changed methods.

  48. MiniMax Assistant

    I should clean up the temporary test file I created, since I was instructed not to add new tests.

  49. MiniMax Assistant

    Let me run the full set of S3 tests one more time to verify everything is fine.

  50. MiniMax Assistant

    Let me check the new error in S3ServiceTest.

  51. MiniMax Assistant

    This is also pre-existing - related to file path encoding and the locale of the JVM. It's NOT related to my fix.

    Let me verify this is pre-existing too.

  52. MiniMax Assistant

    Confirmed - both pre-existing failures are unrelated to my fix. Let me verify the final state of my changes.

  53. MiniMax Assistant

    Let me verify that readFile returns an empty byte array (not null) for empty objects.

  54. MiniMax Assistant

    Let me also check readVersionedFile:

  55. MiniMax Assistant

    Let me check getObjectMetadata to understand how a missing key is handled.

  56. MiniMax Assistant

    Let me think carefully about my changes once more. The removal of start >= totalSize from the validation check could potentially be safer to keep (even if redundant) for minimal change risk. Let me restore it to be safer.

  57. MiniMax Assistant

    Let me do a final review of the diff and make sure everything is good.

  58. MiniMax Assistant

    Let me do one final verification by running all S3 integration tests one more time.

  59. MiniMax Assistant

    Let me also temporarily re-create the reproduction test one more time to confirm the fix is still working.

  60. MiniMax Assistant

    All edge cases pass. Now let me clean up by removing the temporary test file.

  61. MiniMax Assistant

    Let me run a final sanity check and ensure nothing else is broken.

  62. MiniMax Assistant

    Let me run one more S3 test to confirm.

  63. MiniMax Assistant

    Let me do a final review of my changes by looking at the relevant sections.

  64. MiniMax Assistant

    Let me run the final compilation to verify everything is correct.

  65. MiniMax Assistant

    Let me do a final compilation check to confirm everything is good.

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