SigNoz/signoz · error · model.ApiError

invalid %s: %s

Error message

invalid %s: %s

What it means

A pagination/limit-type integer query parameter failed validation: it must parse as an integer and fall within [1, maxValue] for that parameter. This is a model.BadRequest (HTTP 400) wrapping the param name and offending value.

Source

Thrown at pkg/query-service/app/parser.go:532

func parseQBFilterSuggestionsRequest(r *http.Request) (
	*v3.QBFilterSuggestionsRequest, *model.ApiError,
) {
	dataSource := v3.DataSource(r.URL.Query().Get("dataSource"))
	if err := dataSource.Validate(); err != nil {
		return nil, model.BadRequest(err)
	}

	parsePositiveIntQP := func(
		queryParam string, defaultValue uint64, maxValue uint64,
	) (uint64, *model.ApiError) {
		value := defaultValue

		qpValue := r.URL.Query().Get(queryParam)
		if len(qpValue) > 0 {
			value, err := strconv.Atoi(qpValue)

			if err != nil || value < 1 || value > int(maxValue) {
				return 0, model.BadRequest(fmt.Errorf(
					"invalid %s: %s", queryParam, qpValue,
				))
			}
		}

		return value, nil
	}

	attributesLimit, err := parsePositiveIntQP(
		"attributesLimit",
		baseconstants.DefaultFilterSuggestionsAttributesLimit,
		baseconstants.MaxFilterSuggestionsAttributesLimit,
	)
	if err != nil {
		return nil, err
	}

	examplesLimit, err := parsePositiveIntQP(

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Send a positive integer within the allowed range for that parameter
  2. Omit the parameter entirely to use the default
  3. Check the endpoint docs or helper call site for the specific maxValue

Example fix

// before
?limit=0
// after
?limit=10
Defensive patterns

Strategy: validation

Validate before calling

v, err := strconv.Atoi(qpValue)
if err != nil || v < 1 || v > int(maxValue) { return fmt.Errorf("%s must be an integer in [1,%d]", qpValue, maxValue) }

Type guard

func isValidLimit(s string, max int) bool { v, err := strconv.Atoi(s); return err == nil && v >= 1 && v <= max }

Prevention

When it happens

Trigger: Passing ?limit=0, ?limit=-5, ?limit=abc, or a limit above the max (e.g. >100) to endpoints using this helper (filter suggestions, etc.).

Common situations: Passing 0 meaning 'no limit'; passing an oversized page size; passing a float string like '2.5'.

Related errors


AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28). Data as JSON: /api/errors/b186a7105d473ca3. Report an issue: GitHub.