Repository navigation
Description
Summary
A ListObjectsV2 request with start-after pointing at or inside a folder P/ returns
KeyCount=0, IsTruncated=false when the bucket also holds more than about max-keys keys whose names
start with P followed by a byte that sorts before / (for example P-x/…, P.bak/…, or flat keys
P-0001). The keys after start-after exist and are returned by a prefix= listing and by a
continuation-token listing from the start of the bucket.
Because the page says it is the end of the listing, a client that starts a listing from a key
(parallel or resumed listers) silently misses every key after that point, not only the ones in P/.
Versions
Reproduced on:
cgr.dev/chainguard/minioRELEASE.2026-11-23T00-10-37Z(commitdd3f3fa), single drive,server /datacgr.dev/chainguard/minioRELEASE.2026-10-23T20-06-51Zpgsty/siloRELEASE.2026-11-12T00-00-00Z(commit44e848f)
The same 10,761-key test bucket and requests are answered correctly by Garage v2.1.0, SeaweedFS 4.55,
versitygw and moto 5.2.6, and AWS S3 answers the nara-1950-census requests below correctly.
Reproduce (13 empty objects, curl only)
#!/usr/bin/env bash
# Needs curl >= 7.75 (--aws-sigv4). ENDPOINT, AK, SK default to a local server with minioadmin.
set -euo pipefail
EP=${ENDPOINT:-http://127.0.0.1:9000} AK=${AK:-minioadmin} SK=${SK:-minioadmin} B=${BUCKET:-repro-start-after}
s3() { curl -sS --fail-with-body --aws-sigv4 "aws:amz:us-east-1:s3" --user "$AK:$SK" "$@"; }
s3 -X PUT "$EP/$B" -o /dev/null || true
for i in 01 02 03 04 05 06 07 08 09 10; do s3 -X PUT --data-binary '' "$EP/$B/a-x/$i" -o /dev/null; done
for k in a/1 a/2 a/3; do s3 -X PUT --data-binary '' "$EP/$B/$k" -o /dev/null; done
show() { echo "GET ?$1"; s3 "$EP/$B?$1" | grep -oE '<(Key|IsTruncated|KeyCount)>[^<]*' | sed 's/^</ /;s/>/=/'; }
show 'list-type=2&prefix=a%2F'
show 'list-type=2&start-after=a%2F&max-keys=5'
show 'list-type=2&start-after=a%2F1&max-keys=5'
show 'list-type=2&start-after=a%2F&max-keys=10'Output (RELEASE.2026-11-23T00-10-37Z, fresh server):
GET ?list-type=2&prefix=a%2F
KeyCount=3 IsTruncated=false Key=a/1 Key=a/2 Key=a/3
GET ?list-type=2&start-after=a%2F&max-keys=5
KeyCount=0 IsTruncated=false <-- expected a/1 a/2 a/3
GET ?list-type=2&start-after=a%2F1&max-keys=5
KeyCount=0 IsTruncated=false <-- expected a/2 a/3
GET ?list-type=2&start-after=a%2F&max-keys=10
KeyCount=3 IsTruncated=false Key=a/1 Key=a/2 Key=a/3
Expected
Per the S3 API, start-after "can be any key in the bucket" and listing starts after it in UTF-8 binary
order; IsTruncated=false means all remaining results were returned. Expected a/1 a/2 a/3 for
start-after=a/ with any max-keys >= 3.
Observations
-
The sibling must sort before
/.a-x/…anda.x…trigger it;a0/…(which sorts aftera/) does
not. Nested folders behave the same (c/d-x/…withstart-after=c/d/…). -
The threshold follows
max-keys. Withstart-after=a/and 3 keys ina/:keys in a-x/max-keys 1 5 10 50 100 1000 2 ok ok ok ok ok ok 10 0 0 ok ok ok ok 30 0 0 0 ok ok ok 60 0 0 0 0 ok ok 200 0 0 0 0 0 ok With the default
max-keys=1000, 1,064 keys ina-x/list correctly and 1,065 do not. -
Short pages are also marked final. In a larger bucket,
start-after=e/&max-keys=100returned 61 keys
withIsTruncated=falsewhile more than 100 keys follow. -
Everything after the point is lost, not only
P/. With keysa-x/0001…3000 a/1 a/2 e/1 e/2,
start-after=a/2returns nothing, althoughe/1ande/2follow. -
Same for V1 and delimiter listings.
marker=a/1(ListObjects V1) returns 0 keys, and
start-after=a/1&delimiter=/returns onlyCommonPrefixes=e/, withouta/2. -
Adding
prefix=avoids it.prefix=a/&start-after=a/1returnsa/2correctly. Over a 10,761-key
test bucket, 6,286prefix=<folder of start-after>&start-after=…requests were all correct, while 33 of
the same requests withoutprefixwere wrong. -
Continuation tokens are fine. A continuation-token chain from the first key returns every key.
Real-world impact: found with swath, a parallel S3 lister that splits
the key space with start-after; our findings are in varveio/swath#265. The first 250,000 keys of the
public nara-1950-census bucket (folders 1950census-descriptions/, 1950census-maps/, 1950census/)
were loaded into MinIO. Every start-after inside 1950census/ returns an empty final page, so
swath du returned 107,651 of 250,000 keys without an error.
Likely cause (not verified in the source)
The behavior fits a walk that forwards to start-after in filesystem order, where the directory a is
visited before the entries a-x…, but S3 order puts a-x/… before a/. The sibling's entries come after
the forward point in walk order but sort before start-after. They are filtered out, they use up the
batch the listing reads for this page, and the listing then reports that it reached the end.
ListObjectsV2 uses start-after as the marker when no continuation token is given (marker := continuationToken; if marker == "" { marker = startAfter }), which is why V1 marker fails the same way.
Not part of this report
That MinIO refuses or hides a key that is both an object and a folder (h/x with h/x/y) is a known,
documented limitation and is excluded from the numbers above.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsBacklog
Activity
keyrange: check that an S3 listing's final pages are true (#684)