{"record":{"id":"d8d83bdcc9c678c0","repo":"SigNoz/signoz","slug":"invalid-request-query","errorCode":"invalid_request_query","errorMessage":"invalid query","messagePattern":"invalid query","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/http/binding/query.go","lineNumber":19,"sourceCode":"package binding\n\nimport (\n\t\"github.com/SigNoz/signoz/pkg/errors\"\n\tginbinding \"github.com/gin-gonic/gin/binding\"\n)\n\nconst (\n\tErrMessageInvalidQuery string = \"request query contains invalid fields, please verify the format and try again.\"\n)\n\nvar _ BindingQuery = (*queryBinding)(nil)\n\ntype queryBinding struct{}\n\nfunc (b *queryBinding) BindQuery(query map[string][]string, obj any) error {\n\terr := ginbinding.MapFormWithTag(obj, query, \"query\")\n\tif err != nil {\n\t\treturn errors.New(errors.TypeInvalidInput, ErrCodeInvalidRequestQuery, ErrMessageInvalidQuery).WithAdditional(err.Error())\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":1,"sourceCodeEnd":24,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/http/binding/query.go#L1-L24","documentation":"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.","triggerScenarios":"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).","commonSituations":"Hand-written URLs with typos, outdated param names after API version changes, clients sending boolean/number params in wrong formats.","solutions":["Check the endpoint's expected query params and their types; fix the offending value","Inspect the error's additional detail for the exact failing parameter","URL-encode values properly and remove unknown/renamed params"],"exampleFix":"// before\nGET /api/v2/traces?limit=abc\n// after\nGET /api/v2/traces?limit=100","handlingStrategy":"validation","validationCode":"if _, err := strconv.Atoi(r.URL.Query().Get(\"limit\")); err != nil { return fmt.Errorf(\"limit must be an integer\") }","typeGuard":"func validQuery(q url.Values) bool {\n  if l := q.Get(\"limit\"); l != \"\" { if _, err := strconv.Atoi(l); err != nil { return false } }\n  return true\n}","tryCatchPattern":"err := binding.BindQuery(r.URL.Query(), &target)\nif err != nil { /* read errors.Asc detail, report offending param */ }","preventionTips":["Type-check query params client-side","Keep param names in sync with the struct's `query` tags"],"tags":["http","query-parameters","validation","binding"],"backgroundTag":"query-parameter-validation-failed","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}