thanos-io/thanos · error
unable to parse ' ' parameter
Error message
unable to parse '%s' parameter: %w
What it means
Wraps strconv.ParseInt in getStatsLimitParameter: the receive stats endpoint's limit query parameter (LimitStatsQueryParam) is present but not a parseable integer. The raw parameter name and parse error are wrapped; the HTTP handler maps this to a bad-request response.
Solutions
- Pass an integer value for the limit_stats parameter.
- Check the client generating the query string.
- Omit the parameter to use DefaultStatsLimit.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at pkg/receive/handler.go:440 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/e0175414c568f321.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/receive/handler.go:440
return
}
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}
}View on GitHub (pinned to 35b8b99117)