juicedata/juicefs · error

list encode file failed %s

Error message

list encode file failed %s

What it means

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.

Source

Thrown at cmd/objbench.go:983

			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())
			}
		}
		return nil
	})

	runCase("put a big object", func(blob object.ObjectStorage) error {
		fsize := 256 << 20
		buffL := 4 << 20
		buff := make([]byte, buffL)
		utils.RandRead(buff)
		count := int(math.Floor(float64(fsize) / float64(buffL)))
		content := make([]byte, fsize)
		for i := 0; i < count; i++ {
			copy(content[i*buffL:(i+1)*buffL], buff)
		}
		if err := blob.Put(ctx, key, bytes.NewReader(content)); err != nil {

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Inspect the wrapped error after 'list encode file failed'
  2. Check the driver's URL encoding of unicode prefix parameters
  3. If the backend doesn't support the required List signature, it should return utils.ErrNotSUP — fix the driver to do so
  4. Update the driver/juicefs version

Example fix

// before
if resp, _, _, err := blob.List(...); err != nil && err != utils.ErrNotSUP {
    return fmt.Errorf("list encode file failed %s", err)
}
// after: driver-side, return the tolerated sentinel for unsupported backends
return nil, nil, nil, utils.ErrNotSUP
Defensive patterns

Strategy: try-catch

Validate before calling

resp, _, _, err := blob.List(ctx, "", prefix, "", "", 1, true)
if err != nil && err != utils.ErrNotSUP { /* real List failure */ }

Try / catch

resp, _, _, err := blob.List(...)
if err != nil {
    if err == utils.ErrNotSUP {
        // tolerated: backend doesn't support this List signature
    } else {
        return fmt.Errorf("list encode file failed %s", err)
    }
}

Prevention

When it happens

Trigger: `blob.List(ctx, "", "测试编码文件", "", "", 1, true)` returns an error that is not utils.ErrNotSUP during the special-key test.

Common situations: Driver bugs handling unicode prefixes in List requests; endpoint encoding issues; backends erroring on the continuation-token parameters.

Understand the failure class

Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.

Related errors


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/f18869730703efcc. Report an issue: GitHub.