juicedata/juicefs · error
the result for list is incorrect
Error message
the result for list is incorrect
What it means
After listing the hashKey* objects, objbench compares returned keys against the lexicographically sorted key slice and reports this plain message when they differ. It means the backend's List did not return keys in lexicographic order or missed/duplicated keys.
Source
Thrown at cmd/objbench.go:969
k := fmt.Sprintf("hashKey%d", i)
sortedKeys = append(sortedKeys, k)
if err := blob.Put(ctx, fmt.Sprintf("hashKey%d", i), bytes.NewReader(br)); err != nil {
return fmt.Errorf("put object failed: %s", err.Error())
}
}
sort.Strings(sortedKeys)
defer func() {
for i := 0; i < keyTotal; i++ {
_ = blob.Delete(ctx, fmt.Sprintf("hashKey%d", i))
}
}()
if objs, err := listAll(ctx, blob, "hashKey", "", int64(keyTotal)); err != nil {
return fmt.Errorf("list failed: %s", err)
} else {
for i := 0; i < keyTotal; i++ {
if objs[i].Key() != sortedKeys[i] {
return fmt.Errorf("the result for list is incorrect")
}
}
}
return nil
})
runCase("special key", func(blob object.ObjectStorage) error {
key := "测试编码文件" + `{"name":"juicefs"}` + string('\u001F') + "%uFF081%uFF09.jpg"
defer blob.Delete(ctx, key) //nolint:errcheck
if err := blob.Put(ctx, key, bytes.NewReader([]byte("1"))); err != nil {
return fmt.Errorf("put encode file failed: %s", err)
} else {
if resp, _, _, err := blob.List(ctx, "", "测试编码文件", "", "", 1, true); err != nil && err != utils.ErrNotSUP {
return fmt.Errorf("list encode file failed %s", err)
} else if len(resp) == 1 && resp[0].Key() != key {
return fmt.Errorf("list encode file failed: expect key %s, but got %s", key, resp[0].Key())
}
}View on GitHub (pinned to c9a67b23e8)
Solutions
- Fix or upgrade the object storage implementation so List returns keys in lexicographic order
- Run objbench against a different backend to isolate whether the driver is at fault
- Ensure no concurrent writers touch the same prefix during the benchmark
Defensive patterns
Strategy: validation
Validate before calling
keys := make([]string, len(objs))
for i, o := range objs { keys[i] = o.Key() }
if !sort.StringsAreSorted(keys) { /* backend list ordering broken */ } Prevention
- Test custom object-storage drivers with objbench before production use
- Never rely on unsorted List output; sort client-side if unsure
- Ensure no concurrent writers during ordering tests
When it happens
Trigger: `objs[i].Key() != sortedKeys[i]` during the objbench sorting test — the backend returns out-of-order, missing, or extra keys for prefix 'hashKey'.
Common situations: Custom or buggy object storage implementations that don't sort List results lexicographically; backends with non-standard key encodings; concurrent writers adding hashKey-like keys mid-test.
Understand the failure class
Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.
Related errors
- list should return 2 keys, but got %d
- first key should be empty string, but got %s
- first object size should be 0, but got %d
- first key should be test, but got %s
- size of first key shold be 5, but got %v
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/2265824b908b127a.
Report an issue: GitHub.