Skip to content
TheChatArchiveThe Chat Archive
fable-5· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

Untitled conversation

  1. User

    [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.

  2. Assistant

    Now let me check existing tests for range handling:

  3. Assistant

    Now add an integration test. Let me look at test ordering near the range tests:

  4. Assistant

    All 99 S3 integration tests pass. Let me confirm the new test executed:

  5. Assistant

    The new test ran and passed. Let me also run the other S3 test classes that exercise the controller:

  6. Assistant

    All green. The fix is complete.

    Summary

    Bug: GetObject with a suffix range (Range: bytes=-1) against an empty object returned 416 InvalidRange, because handleRangeRequest computed start = 0, end = -1 and hit the start > end rejection. Real S3 ignores a suffix range on a zero-byte object and returns 200 OK with the full (empty) body — which Trino's readTail on empty files depends on.

    Changes:

    • src/main/java/io/github/hectorvent/floci/services/s3/S3Controller.java

      • handleRangeRequest now returns null when a suffix range (bytes=-N) targets a zero-byte object, signaling the caller to fall through (S3Controller.java:648-652).
      • The getObject call site checks for null and falls through to the normal 200 full-object response path (S3Controller.java:593-598).
      • Behavior for start-based ranges on empty objects (bytes=0-) is unchanged — still 416, matching real S3.
    • src/test/java/io/github/hectorvent/floci/services/s3/S3IntegrationTest.java

      • New getEmptyObjectWithSuffixRange test (Order 41): puts an empty object, asserts bytes=-1 returns 200 with Content-Length: 0 and empty body, and asserts bytes=0- still returns 416 with Content-Range: bytes */0.

    Verification: S3IntegrationTest (99 tests), PreSignedUrlIntegrationTest (14), and S3PresignedPostIntegrationTest (19) all pass with no failures.

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