{"record":{"id":"0584e214813be4ac","repo":"SigNoz/signoz","slug":"codeinvalidinput-0584e2","errorCode":"CodeInvalidInput","errorMessage":"page must be a valid integer","messagePattern":"page must be a valid integer","errorType":"http","errorClass":"errors.SignozError","httpStatus":400,"severity":"warning","filePath":"pkg/gateway/handler.go","lineNumber":47,"sourceCode":"}\n\nfunc (handler *handler) GetIngestionKeys(rw http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\n\tclaims, err := authtypes.ClaimsFromContext(ctx)\n\tif err != nil {\n\t\trender.Error(rw, err)\n\t\treturn\n\t}\n\n\torgID := valuer.MustNewUUID(claims.OrgID)\n\n\tpageString := r.URL.Query().Get(\"page\")\n\tperPageString := r.URL.Query().Get(\"per_page\")\n\n\tpage, err := parseIntWithDefaultValue(pageString, DefaultPage)\n\tif err != nil {\n\t\trender.Error(rw, errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, \"page must be a valid integer\"))\n\t\treturn\n\t}\n\n\tperPage, err := parseIntWithDefaultValue(perPageString, DefaultPageSize)\n\tif err != nil {\n\t\trender.Error(rw, errors.New(errors.TypeInvalidInput, errors.CodeInvalidInput, \"per_page must be a valid integer\"))\n\t\treturn\n\t}\n\n\tresponse, err := handler.gateway.GetIngestionKeys(ctx, orgID, page, perPage)\n\tif err != nil {\n\t\trender.Error(rw, err)\n\t\treturn\n\t}\n\n\trender.Success(rw, http.StatusOK, response)\n}\n","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/gateway/handler.go#L29-L65","documentation":"Returned by the GetIngestionKeys HTTP handler when the page query parameter is present but cannot be parsed as an integer (parseIntWithDefaultValue fails after trimming). It is a 400-class validation error on list pagination input.","triggerScenarios":"GET /api/v1/ingestion-keys?page=abc (or \"1.5\", \"1e3\", \"-\", empty-but-formatted-odd strings); any non-integer page value other than a plain missing parameter.","commonSituations":"Frontend sending page from an unvalidated input field; commas or spaces in query strings (\"page=1,\"); localized number formats; copy-pasted URLs with stray characters.","solutions":["Send page as a base-10 integer (?page=2) or omit it to use the default","Sanitize/parseInt on the client before building the URL","Check for stray whitespace, commas, or duplicate page params in the query string"],"exampleFix":"// before\nGET /api/v1/ingestion-keys?page=2nd\n\n// after\nGET /api/v1/ingestion-keys?page=2","handlingStrategy":"validation","validationCode":"page, err := strconv.Atoi(strings.TrimSpace(pageString))\nif err != nil { page = 1 } // or reject client-side before fetch","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Coerce pagination inputs with parseInt in the client before building URLs","Write contract tests asserting non-integer page returns 400"],"tags":["http","pagination","query-params","validation","go"],"backgroundTag":"invalid-query-parameter","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}