{"record":{"id":"5fe42484d5ae8898","repo":"SigNoz/signoz","slug":"errorbaddata","errorCode":"ErrorBadData","errorMessage":"ErrorID missing from params","messagePattern":"ErrorID missing from params","errorType":"validation","errorClass":"model.ApiError","httpStatus":400,"severity":"error","filePath":"pkg/query-service/app/clickhouseReader/reader.go","lineNumber":2398,"sourceCode":"\n\tif err != nil {\n\t\tr.logger.Error(\"Error in processing sql query\", errorsV2.Attr(err))\n\t\treturn nil, &model.ApiError{Typ: model.ErrorExec, Err: fmt.Errorf(\"error in processing sql query\")}\n\t}\n\n\tif len(getErrorWithSpanReponse) > 0 {\n\t\treturn &getErrorWithSpanReponse[0], nil\n\t} else {\n\t\treturn nil, &model.ApiError{Typ: model.ErrorNotFound, Err: fmt.Errorf(\"Error/Exception not found\")}\n\t}\n\n}\n\nfunc (r *ClickHouseReader) GetNextPrevErrorIDs(ctx context.Context, queryParams *model.GetErrorParams) (*model.NextPrevErrorIDs, *model.ApiError) {\n\n\tif queryParams.ErrorID == \"\" {\n\t\tr.logger.Error(\"errorId missing from params\")\n\t\treturn nil, &model.ApiError{Typ: model.ErrorBadData, Err: fmt.Errorf(\"ErrorID missing from params\")}\n\t}\n\tvar apiErr *model.ApiError\n\tgetNextPrevErrorIDsResponse := model.NextPrevErrorIDs{\n\t\tGroupID: queryParams.GroupID,\n\t}\n\tgetNextPrevErrorIDsResponse.NextErrorID, getNextPrevErrorIDsResponse.NextTimestamp, apiErr = r.getNextErrorID(ctx, queryParams)\n\tif apiErr != nil {\n\t\tr.logger.Error(\"Unable to get next error ID due to err: \", errorsV2.Attr(apiErr))\n\t\treturn nil, apiErr\n\t}\n\tgetNextPrevErrorIDsResponse.PrevErrorID, getNextPrevErrorIDsResponse.PrevTimestamp, apiErr = r.getPrevErrorID(ctx, queryParams)\n\tif apiErr != nil {\n\t\tr.logger.Error(\"Unable to get prev error ID due to err: \", errorsV2.Attr(apiErr))\n\t\treturn nil, apiErr\n\t}\n\treturn &getNextPrevErrorIDsResponse, nil\n\n}","sourceCodeStart":2380,"sourceCodeEnd":2416,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/app/clickhouseReader/reader.go#L2380-L2416","documentation":"GetNextPrevErrorIDs validates its input and rejects the call with ErrorBadData when queryParams.ErrorID is an empty string. This is a client-side argument validation error raised before any SQL is issued, so it always indicates a malformed or incomplete API request rather than a backend problem.","triggerScenarios":"Calling the next/prev error navigation endpoint without an errorId query parameter, or programatically constructing model.GetErrorParams{ErrorID: \"\"} and passing it to GetNextPrevErrorIDs.","commonSituations":"Frontend navigating between error events sends an empty errorId because of a race where the detail panel loads before the selected error is set; a script iterating over a list of errors hits an entry with a missing ID; query-string parsing drops the param when it contains special characters.","solutions":["Fix the caller to always supply a non-empty errorID before invoking the API","Add request-level validation in the HTTP handler so a 400 is returned with a clear message instead of reaching the reader","URL-encode the errorID when building links from the UI","Log the incoming params at the handler boundary to find which client sends empty IDs"],"exampleFix":"// before\nresp, apiErr := reader.GetNextPrevErrorIDs(ctx, queryParams)\n\n// after\nif queryParams.ErrorID == \"\" {\n  return nil, &model.ApiError{Typ: model.ErrorBadData, Err: fmt.Errorf(\"errorId is required\")}\n}\nresp, apiErr := reader.GetNextPrevErrorIDs(ctx, queryParams)","handlingStrategy":"validation","validationCode":"if queryParams.ErrorID == \"\" {\n  return nil, &model.ApiError{Typ: model.ErrorBadData, Err: fmt.Errorf(\"errorId is required\")}\n}\nresp, apiErr := reader.GetNextPrevErrorIDs(ctx, queryParams)","typeGuard":"func hasErrorID(p *model.GetErrorParams) bool { return p != nil && strings.TrimSpace(p.ErrorID) != \"\" }","tryCatchPattern":"// check ApiError.Typ == model.ErrorBadData and return 400 to the client with a clear field message","preventionTips":["Validate required params at the HTTP handler before hitting the reader","UI: only enable next/prev navigation once an errorID is set","URL-encode IDs when building navigation links"],"tags":["validation","bad-request","errors-api","query-service"],"backgroundTag":"missing-required-parameter","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}