googleapis/mcp-toolbox · error

range %q requires at least one bound

Error message

range %q requires at least one bound

What it means

Range-parser guard in parseRange: both the start and end bounds around the '-' are empty (a bare 'bytes=-'), which specifies no bytes at all.

Source

Thrown at internal/tools/cloudstorage/cloudstoragereadobject/cloudstoragereadobject.go:179

	}

	spec := strings.TrimSpace(rangeSpec)
	if !strings.HasPrefix(spec, "bytes=") {
		return 0, 0, fmt.Errorf("range %q must start with 'bytes='", rangeSpec)
	}
	spec = strings.TrimPrefix(spec, "bytes=")

	dash := strings.IndexByte(spec, '-')
	if dash < 0 {
		return 0, 0, fmt.Errorf("range %q is missing '-'", rangeSpec)
	}

	startStr := spec[:dash]
	endStr := spec[dash+1:]

	switch {
	case startStr == "" && endStr == "":
		return 0, 0, fmt.Errorf("range %q requires at least one bound", rangeSpec)

	case startStr == "":
		n, parseErr := strconv.ParseInt(endStr, 10, 64)
		if parseErr != nil || n <= 0 {
			return 0, 0, fmt.Errorf("range %q has a bad suffix length", rangeSpec)
		}
		return -n, -1, nil

	case endStr == "":
		start, parseErr := strconv.ParseInt(startStr, 10, 64)
		if parseErr != nil || start < 0 {
			return 0, 0, fmt.Errorf("range %q has a bad start", rangeSpec)
		}
		return start, -1, nil

	default:
		start, parseErr := strconv.ParseInt(startStr, 10, 64)
		if parseErr != nil || start < 0 {

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Provide at least one bound, e.g. 'bytes=0-' or 'bytes=-100'
  2. Drop the range parameter to read the full object
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/tools/cloudstorage/cloudstoragereadobject/cloudstoragereadobject.go:179 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/158a26e5bac498a3. Report an issue: GitHub.