SigNoz/signoz · error

invalid_request_query

invalid_request_query

Error message

invalid query

What it means

BindQuery fails when request query parameters cannot be mapped onto the target struct using the 'query' tag. The underlying gin MapFormWithTag error is attached as additional detail, covering bad type conversions and malformed syntax.

Source

Thrown at pkg/http/binding/query.go:19

package binding

import (
	"github.com/SigNoz/signoz/pkg/errors"
	ginbinding "github.com/gin-gonic/gin/binding"
)

const (
	ErrMessageInvalidQuery string = "request query contains invalid fields, please verify the format and try again."
)

var _ BindingQuery = (*queryBinding)(nil)

type queryBinding struct{}

func (b *queryBinding) BindQuery(query map[string][]string, obj any) error {
	err := ginbinding.MapFormWithTag(obj, query, "query")
	if err != nil {
		return errors.New(errors.TypeInvalidInput, ErrCodeInvalidRequestQuery, ErrMessageInvalidQuery).WithAdditional(err.Error())
	}

	return nil
}

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Check the endpoint's expected query params and their types; fix the offending value
  2. Inspect the error's additional detail for the exact failing parameter
  3. URL-encode values properly and remove unknown/renamed params

Example fix

// before
GET /api/v2/traces?limit=abc
// after
GET /api/v2/traces?limit=100
Defensive patterns

Strategy: validation

Validate before calling

if _, err := strconv.Atoi(r.URL.Query().Get("limit")); err != nil { return fmt.Errorf("limit must be an integer") }

Type guard

func validQuery(q url.Values) bool {
  if l := q.Get("limit"); l != "" { if _, err := strconv.Atoi(l); err != nil { return false } }
  return true
}

Try / catch

err := binding.BindQuery(r.URL.Query(), &target)
if err != nil { /* read errors.Asc detail, report offending param */ }

Prevention

When it happens

Trigger: Calling endpoints like ListV2, GetFieldsKeys, GetFieldsValues, or public widget APIs with query params that don't match expected types (e.g. limit=abc, bad timestamps, invalid enum values).

Common situations: Hand-written URLs with typos, outdated param names after API version changes, clients sending boolean/number params in wrong formats.

Related errors


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