{"record":{"id":"2fca79e0cfc8ed40","repo":"juicedata/juicefs","slug":"list-should-not-return-anything-but-got-d","errorCode":null,"errorMessage":"list should not return anything, but got %d","messagePattern":"list should not return anything, but got (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/objbench.go","lineNumber":919,"sourceCode":"\t\t\t\tif objs[1].Key() != key {\n\t\t\t\t\treturn fmt.Errorf(\"first key should be test, but got %s\", objs[1].Key())\n\t\t\t\t}\n\t\t\t\tif objs[1].Size() != 5 {\n\t\t\t\t\treturn fmt.Errorf(\"size of first key shold be 5, but got %v\", objs[1].Size())\n\t\t\t\t}\n\t\t\t\tnow := time.Now()\n\t\t\t\tif objs[1].Mtime().Before(now.Add(-30*time.Second)) || objs[1].Mtime().After(now.Add(time.Second*30)) {\n\t\t\t\t\treturn fmt.Errorf(\"mtime of key should be within 30 seconds, but got %s\", objs[1].Mtime().Sub(now))\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"list failed: %s\", err)\n\t\t\t}\n\n\t\t\tobjs, err = listAll(ctx, blob, \"\", \"test2\", 1)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"list failed: %s\", err)\n\t\t\t} else if len(objs) != 0 {\n\t\t\t\treturn fmt.Errorf(\"list should not return anything, but got %d\", len(objs))\n\t\t\t}\n\t\t} else {\n\t\t\tobjs, err2 := listAll(ctx, blob, \"\", \"\", 1)\n\t\t\tif err2 == nil {\n\t\t\t\tif len(objs) != 1 {\n\t\t\t\t\treturn fmt.Errorf(\"list should return 1 keys, but got %d\", len(objs))\n\t\t\t\t}\n\t\t\t\tif objs[0].Key() != key {\n\t\t\t\t\treturn fmt.Errorf(\"first key should be test, but got %s\", objs[0].Key())\n\t\t\t\t}\n\t\t\t\tif objs[0].Size() != 5 {\n\t\t\t\t\treturn fmt.Errorf(\"size of first key shold be 5, but got %v\", objs[0].Size())\n\t\t\t\t}\n\t\t\t\tnow := time.Now()\n\t\t\t\tif objs[0].Mtime().Before(now.Add(-30*time.Second)) || objs[0].Mtime().After(now.Add(time.Second*30)) {\n\t\t\t\t\treturn fmt.Errorf(\"mtime of key should be within 30 seconds, but got %s\", objs[0].Mtime().Sub(now))\n\t\t\t\t}\n\t\t\t} else {","sourceCodeStart":901,"sourceCodeEnd":937,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/cmd/objbench.go#L901-L937","documentation":"In the filesystem branch of objbench's \"list objects\" case, a LIST with prefix \"test2\" (which was never created) must return zero objects. This message means the backend returned a non-empty list for a prefix that has no keys, i.e. prefix filtering is broken or leftover keys from a previous run exist.","triggerScenarios":"`juicefs objbench` on a filesystem backend that ignores the \"test2\" prefix and returns all keys; or a polluted bucket where keys starting with \"test2\" already exist from earlier runs.","commonSituations":"Custom object storage whose List does not honor prefix; running objbench twice without cleanup in a shared bucket; keys colliding with the bench's naming.","solutions":["Clean the bucket/prefix of leftovers from prior objbench runs before testing.","Fix the backend's List to apply the prefix filter correctly.","Use a dedicated, empty bucket for objbench to avoid collisions.","Re-run objbench after cleanup to confirm the empty-prefix list behavior."],"exampleFix":"// before: ignoring prefix\nif strings.HasPrefix(k, prefix) || prefix == \"\" {...}\n// after: always filter\nif strings.HasPrefix(k, prefix) {...}","handlingStrategy":"validation","validationCode":"objs, err := listAll(ctx, blob, \"\", \"test2\", 1)\nif err == nil && len(objs) != 0 {\n    return fmt.Errorf(\"stale keys under test2; clean the bucket first\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use a dedicated empty bucket for objbench.","Clean leftover keys from previous runs before testing.","Implement prefix filtering correctly in custom backends."],"tags":["object-storage","objbench","list","prefix-filter"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}