thanos-io/thanos · error
' ' parameter is larger than
Error message
'%s' parameter is larger than %d
What it means
A range guard in getStatsLimitParameter: the parsed limit query parameter exceeds math.MaxInt and therefore cannot be represented as int on the target platform. The request is rejected rather than truncating the limit; the parameter name and bound are included.
Solutions
- Send a limit_stats value within int range.
- Clamp the value client-side before the request.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at pkg/receive/handler.go:443 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/58386fdb14b39c94.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/receive/handler.go:443
w.WriteHeader(http.StatusServiceUnavailable)
_, err := fmt.Fprintf(w, "Service Unavailable")
if err != nil {
h.logger.Log("msg", "failed to write to response body", "err", err)
}
}
}
func getStatsLimitParameter(r *http.Request) (int, error) {
statsLimitStr := r.URL.Query().Get(LimitStatsQueryParam)
if statsLimitStr == "" {
return DefaultStatsLimit, nil
}
statsLimit, err := strconv.ParseInt(statsLimitStr, 10, 0)
if err != nil {
return 0, fmt.Errorf("unable to parse '%s' parameter: %w", LimitStatsQueryParam, err)
}
if statsLimit > math.MaxInt {
return 0, fmt.Errorf("'%s' parameter is larger than %d", LimitStatsQueryParam, math.MaxInt)
}
return int(statsLimit), nil
}
func (h *Handler) getStats(r *http.Request, statsByLabelName string) ([]api.TenantStats, *api.ApiError) {
if !h.isReady() {
return nil, &api.ApiError{Typ: api.ErrorInternal, Err: fmt.Errorf("service unavailable")}
}
tenantID := r.Header.Get(h.options.TenantHeader)
getAllTenantStats := r.FormValue(AllTenantsQueryParam) == "true"
if getAllTenantStats && tenantID != "" {
err := fmt.Errorf("using both the %s parameter and the %s header is not supported", AllTenantsQueryParam, h.options.TenantHeader)
return nil, &api.ApiError{Typ: api.ErrorBadData, Err: err}
}
statsLimit, err := getStatsLimitParameter(r)
if err != nil {View on GitHub (pinned to 35b8b99117)