{"record":{"id":"f18869730703efcc","repo":"juicedata/juicefs","slug":"list-encode-file-failed-s","errorCode":null,"errorMessage":"list encode file failed %s","messagePattern":"list encode file failed (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/objbench.go","lineNumber":983,"sourceCode":"\t\t\treturn fmt.Errorf(\"list failed: %s\", err)\n\t\t} else {\n\t\t\tfor i := 0; i < keyTotal; i++ {\n\t\t\t\tif objs[i].Key() != sortedKeys[i] {\n\t\t\t\t\treturn fmt.Errorf(\"the result for list is incorrect\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\n\trunCase(\"special key\", func(blob object.ObjectStorage) error {\n\t\tkey := \"测试编码文件\" + `{\"name\":\"juicefs\"}` + string('\\u001F') + \"%uFF081%uFF09.jpg\"\n\t\tdefer blob.Delete(ctx, key) //nolint:errcheck\n\t\tif err := blob.Put(ctx, key, bytes.NewReader([]byte(\"1\"))); err != nil {\n\t\t\treturn fmt.Errorf(\"put encode file failed: %s\", err)\n\t\t} else {\n\t\t\tif resp, _, _, err := blob.List(ctx, \"\", \"测试编码文件\", \"\", \"\", 1, true); err != nil && err != utils.ErrNotSUP {\n\t\t\t\treturn fmt.Errorf(\"list encode file failed %s\", err)\n\t\t\t} else if len(resp) == 1 && resp[0].Key() != key {\n\t\t\t\treturn fmt.Errorf(\"list encode file failed: expect key %s, but got %s\", key, resp[0].Key())\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\n\trunCase(\"put a big object\", func(blob object.ObjectStorage) error {\n\t\tfsize := 256 << 20\n\t\tbuffL := 4 << 20\n\t\tbuff := make([]byte, buffL)\n\t\tutils.RandRead(buff)\n\t\tcount := int(math.Floor(float64(fsize) / float64(buffL)))\n\t\tcontent := make([]byte, fsize)\n\t\tfor i := 0; i < count; i++ {\n\t\t\tcopy(content[i*buffL:(i+1)*buffL], buff)\n\t\t}\n\t\tif err := blob.Put(ctx, key, bytes.NewReader(content)); err != nil {","sourceCodeStart":965,"sourceCodeEnd":1001,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/cmd/objbench.go#L965-L1001","documentation":"After putting the special-encoded key, objbench lists with prefix '测试编码文件' and reports this when List returns an error other than utils.ErrNotSUP (unsupported). ErrNotSUP is tolerated because some backends don't support continuation-token listing; any other error fails the case.","triggerScenarios":"`blob.List(ctx, \"\", \"测试编码文件\", \"\", \"\", 1, true)` returns an error that is not utils.ErrNotSUP during the special-key test.","commonSituations":"Driver bugs handling unicode prefixes in List requests; endpoint encoding issues; backends erroring on the continuation-token parameters.","solutions":["Inspect the wrapped error after 'list encode file failed'","Check the driver's URL encoding of unicode prefix parameters","If the backend doesn't support the required List signature, it should return utils.ErrNotSUP — fix the driver to do so","Update the driver/juicefs version"],"exampleFix":"// before\nif resp, _, _, err := blob.List(...); err != nil && err != utils.ErrNotSUP {\n    return fmt.Errorf(\"list encode file failed %s\", err)\n}\n// after: driver-side, return the tolerated sentinel for unsupported backends\nreturn nil, nil, nil, utils.ErrNotSUP","handlingStrategy":"try-catch","validationCode":"resp, _, _, err := blob.List(ctx, \"\", prefix, \"\", \"\", 1, true)\nif err != nil && err != utils.ErrNotSUP { /* real List failure */ }","typeGuard":null,"tryCatchPattern":"resp, _, _, err := blob.List(...)\nif err != nil {\n    if err == utils.ErrNotSUP {\n        // tolerated: backend doesn't support this List signature\n    } else {\n        return fmt.Errorf(\"list encode file failed %s\", err)\n    }\n}","preventionTips":["Drivers for limited backends should return utils.ErrNotSUP, not arbitrary errors","Verify unicode prefix URL-encoding in the driver","Keep the driver updated for List API changes"],"tags":["object-storage","list","encoding"],"backgroundTag":"api-request-failed","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}