{"record":{"id":"2ff368504b02a5c1","repo":"thanos-io/thanos","slug":"using-both-the-s-parameter-and-the-s-header-is-n","errorCode":null,"errorMessage":"using both the %s parameter and the %s header is not supported","messagePattern":"using both the (.+?) parameter and the (.+?) header is not supported","errorType":"validation","errorClass":"api.ApiError","httpStatus":400,"severity":"error","filePath":"pkg/receive/handler.go","lineNumber":456,"sourceCode":"\tstatsLimit, err := strconv.ParseInt(statsLimitStr, 10, 0)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"unable to parse '%s' parameter: %w\", LimitStatsQueryParam, err)\n\t}\n\tif statsLimit > math.MaxInt {\n\t\treturn 0, fmt.Errorf(\"'%s' parameter is larger than %d\", LimitStatsQueryParam, math.MaxInt)\n\t}\n\treturn int(statsLimit), nil\n}\n\nfunc (h *Handler) getStats(r *http.Request, statsByLabelName string) ([]api.TenantStats, *api.ApiError) {\n\tif !h.isReady() {\n\t\treturn nil, &api.ApiError{Typ: api.ErrorInternal, Err: fmt.Errorf(\"service unavailable\")}\n\t}\n\n\ttenantID := r.Header.Get(h.options.TenantHeader)\n\tgetAllTenantStats := r.FormValue(AllTenantsQueryParam) == \"true\"\n\tif getAllTenantStats && tenantID != \"\" {\n\t\terr := fmt.Errorf(\"using both the %s parameter and the %s header is not supported\", AllTenantsQueryParam, h.options.TenantHeader)\n\t\treturn nil, &api.ApiError{Typ: api.ErrorBadData, Err: err}\n\t}\n\n\tstatsLimit, err := getStatsLimitParameter(r)\n\tif err != nil {\n\t\treturn nil, &api.ApiError{Typ: api.ErrorBadData, Err: err}\n\t}\n\n\tif getAllTenantStats {\n\t\treturn h.options.TSDBStats.TenantStats(statsLimit, statsByLabelName), nil\n\t}\n\n\tif tenantID == \"\" {\n\t\ttenantID = h.options.DefaultTenantID\n\t}\n\n\treturn h.options.TSDBStats.TenantStats(statsLimit, statsByLabelName, tenantID), nil\n}","sourceCodeStart":438,"sourceCodeEnd":474,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/receive/handler.go#L438-L474","documentation":"A mutually-exclusive-inputs guard in Handler.getStats: the request supplies both the stats-by-label query parameter and its corresponding HTTP header at the same time, which is unsupported because they compete to select the grouping label. The request is rejected as bad input rather than guessing precedence.","triggerScenarios":"Thrown at pkg/receive/handler.go:456 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Send the limit via only one of parameter or header.","Update the client to not duplicate the limit."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}