juicedata/juicefs · error

failed to get object with the offset out of range, expect ""

Error message

failed to get object with the offset out of range, expect "", but got %q, error: %s

What it means

Returned by objbench's ranged-read test when a GET whose offset is beyond the object size does not return an empty result as expected. Backends differ on out-of-range handling; this check flags ones that return data or wrong errors instead of empty.

Source

Thrown at cmd/objbench.go:837

		// get last
		if d, e := get(blob, key, 4, 1); e != nil || d != "o" {
			return fmt.Errorf(`failed to get the last byte: expect "o", but got %q, error: %s`, d, e)
		}
		// get last 3
		if d, e := get(blob, key, 2, 3); e != nil || d != "llo" {
			return fmt.Errorf(`failed to get the last three bytes: expect "llo", but got %q, error: %s`, d, e)
		}
		// get middle
		if d, e := get(blob, key, 2, 2); e != nil || d != "ll" {
			return fmt.Errorf(`failed to get two bytes: expect "ll", but got %q, error: %s`, d, e)
		}
		// get the end out of range
		if d, e := get(blob, key, 4, 2); e != nil || d != "o" {
			return warning(fmt.Errorf(`failed to get object with the end out of range, expect "o", but got %q, error: %s`, d, e))
		}
		// get the off out of range
		if d, e := get(blob, key, 6, 2); e != nil || d != "" {
			return warning(fmt.Errorf(`failed to get object with the offset out of range, expect "", but got %q, error: %s`, d, e))
		}
		return nil
	})

	runCase("head an object", func(blob object.ObjectStorage) error {
		br := []byte("hello")
		if err := blob.Put(ctx, key, bytes.NewReader(br)); err != nil {
			return fmt.Errorf("put object failed: %s", err)
		}
		defer blob.Delete(ctx, key) //nolint:errcheck
		if h, err := blob.Head(ctx, key); err != nil {
			return fmt.Errorf("failed to head object %s", err)
		} else {
			if h.Key() != key {
				return fmt.Errorf("expected key 'test' but got %s", h.Key())
			}
		}
		return nil

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Treat as a backend ranged-read semantic difference to note in benchmark results
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cmd/objbench.go:837 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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