{"record":{"id":"07ff6f7d9917afae","repo":"SigNoz/signoz","slug":"threshold-param-missing-in-query","errorCode":null,"errorMessage":"threshold param missing in query","messagePattern":"threshold param missing in query","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/query-service/model/v3/v3.go","lineNumber":1150,"sourceCode":"\t\t\t\t}\n\t\t\t\talpha, ok := function.Args[0].(float64)\n\t\t\t\tif !ok {\n\t\t\t\t\t// if string, attempt to convert to float\n\t\t\t\t\talpha, err := strconv.ParseFloat(function.Args[0].(string), 64)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"alpha param should be a float\")\n\t\t\t\t\t}\n\t\t\t\t\tfunction.Args[0] = alpha\n\t\t\t\t}\n\t\t\t\tif alpha < 0 || alpha > 1 {\n\t\t\t\t\treturn fmt.Errorf(\"alpha param should be between 0 and 1\")\n\t\t\t\t}\n\t\t\t} else if function.Name == FunctionNameCutOffMax ||\n\t\t\t\tfunction.Name == FunctionNameCutOffMin ||\n\t\t\t\tfunction.Name == FunctionNameClampMax ||\n\t\t\t\tfunction.Name == FunctionNameClampMin {\n\t\t\t\tif len(function.Args) == 0 {\n\t\t\t\t\treturn fmt.Errorf(\"threshold param missing in query\")\n\t\t\t\t}\n\t\t\t\t_, ok := function.Args[0].(float64)\n\t\t\t\tif !ok {\n\t\t\t\t\t// if string, attempt to convert to float\n\t\t\t\t\tif _, ok := function.Args[0].(string); !ok {\n\t\t\t\t\t\treturn fmt.Errorf(\"threshold param should be a float\")\n\t\t\t\t\t}\n\t\t\t\t\tthreshold, err := strconv.ParseFloat(function.Args[0].(string), 64)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"threshold param should be a float\")\n\t\t\t\t\t}\n\t\t\t\t\tfunction.Args[0] = threshold\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil","sourceCodeStart":1132,"sourceCodeEnd":1168,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/model/v3/v3.go#L1132-L1168","documentation":"cutOffMax/cutOffMin/clampMax/clampMin require a threshold argument. Validate() returns this when Args is empty for those functions.","triggerScenarios":"\"functions\":[{\"name\":\"cutOffMax\"}] with no args array.","commonSituations":"Query-builder UI state where the threshold input was left blank; programmatic query assembly skipping empty inputs entirely instead of erroring early.","solutions":["Add a numeric threshold, e.g. \"args\":[100]","Make the threshold field required in whatever produces the query"],"exampleFix":"// before\n{\"name\":\"cutOffMax\"}\n// after\n{\"name\":\"cutOffMax\",\"args\":[100]}","handlingStrategy":"validation","validationCode":"needsThreshold := map[string]bool{\"cutOffMax\":true,\"cutOffMin\":true,\"clampMax\":true,\"clampMin\":true}\nif needsThreshold[string(f.Name)] && len(f.Args) == 0 { return errors.New(\"threshold required\") }","typeGuard":"func thresholdProvided(f v3.Function) bool { return !map[string]bool{\"cutOffMax\":true,\"cutOffMin\":true,\"clampMax\":true,\"clampMin\":true}[string(f.Name)] || len(f.Args) > 0 }","tryCatchPattern":null,"preventionTips":["Make threshold a required UI field for clamp/cutOff functions"],"tags":["signoz","query-builder","cutoff","validation"],"backgroundTag":"query-validation-failed","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}