{"record":{"id":"9ee126a908853a73","repo":"juicedata/juicefs","slug":"list-should-return-1-keys-but-got-d","errorCode":null,"errorMessage":"list should return 1 keys, but got %d","messagePattern":"list should return 1 keys, but got (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/objbench.go","lineNumber":925,"sourceCode":"\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 {\n\t\t\t\treturn fmt.Errorf(\"list failed: %s\", err2)\n\t\t\t}\n\n\t\t\tobjs, err2 = listAll(ctx, blob, \"\", \"test2\", 1)\n\t\t\tif err2 != nil {\n\t\t\t\treturn fmt.Errorf(\"list failed: %s\", err2)","sourceCodeStart":907,"sourceCodeEnd":943,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/cmd/objbench.go#L907-L943","documentation":"In the non-filesystem branch of objbench's \"list objects\" case, `listAll(ctx, blob, \"\", \"\", 1)` must return exactly 1 key (the single \"test\" object put just before). This message means the backend returned a different number of keys for a maxKeys=1 list, violating list pagination/limit semantics.","triggerScenarios":"`juicefs objbench` on a non-filesystem object storage that ignores the maxKeys limit and returns more objects, or returns zero keys despite the put succeeding, or lists leftover keys in a dirty bucket.","commonSituations":"Custom backend that ignores the `maxKeys`/limit parameter; shared bucket polluted with other keys; put failed silently or eventual consistency hiding the new key.","solutions":["Run objbench against a clean, dedicated bucket so exactly one key matches.","Fix the backend's List to respect the requested maxKeys (1 here) in a single page.","Verify the earlier Put of key \"test\" succeeded before List is called.","Check for stale objects with the bench key from previous runs and delete them."],"exampleFix":"// backend List: honor limit\nif len(result) > maxKeys { result = result[:maxKeys] }","handlingStrategy":"validation","validationCode":"objs, _ := listAll(ctx, blob, \"\", \"\", 10)\nif len(objs) != 1 {\n    return fmt.Errorf(\"bucket not clean; got %d keys, expected 1\", len(objs))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Benchmark only against a clean, dedicated bucket.","Custom backends must honor the maxKeys parameter.","Verify Put success before asserting on list counts."],"tags":["object-storage","objbench","list","pagination"],"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"}