googleapis/mcp-toolbox · error
range %q has a bad end
Error message
range %q has a bad end
What it means
Range-parser guard for the closed form 'bytes=N-M': the end value M fails to parse as an integer or is smaller than the start N, producing an empty or inverted range.
Source
Thrown at internal/tools/cloudstorage/cloudstoragereadobject/cloudstoragereadobject.go:202
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 {
return 0, 0, fmt.Errorf("range %q has a bad start", rangeSpec)
}
end, parseErr := strconv.ParseInt(endStr, 10, 64)
if parseErr != nil || end < start {
return 0, 0, fmt.Errorf("range %q has a bad end", rangeSpec)
}
return start, end - start + 1, nil
}
}
View on GitHub (pinned to 8cc6e09de2)
Solutions
- Use an end that is an integer greater than or equal to the start, e.g. 'bytes=0-1023'
- Swap the bounds if they were written backwards
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/tools/cloudstorage/cloudstoragereadobject/cloudstoragereadobject.go:202 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/66b92f1f2fd1284d.
Report an issue: GitHub.