{"record":{"id":"950c48dc3ce3bc2b","repo":"SigNoz/signoz","slug":"threshold-param-should-be-a-float","errorCode":null,"errorMessage":"threshold param should be a float","messagePattern":"threshold param should be a float","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/query-service/model/v3/v3.go","lineNumber":1156,"sourceCode":"\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\n}\n\ntype FilterSet struct {\n\tOperator string       `json:\"op,omitempty\"`\n\tItems    []FilterItem `json:\"items\"`\n}","sourceCodeStart":1138,"sourceCodeEnd":1174,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/model/v3/v3.go#L1138-L1174","documentation":"For the clamp/cutOff family, Args[0] must be float64. If it isn't, the code first checks it's at least a string; this error is returned when Args[0] is neither float64 nor string (e.g. bool, nil, map).","triggerScenarios":"\"args\":[true] or [null] on cutOffMin/clampMax etc. — any non-float, non-string JSON value.","commonSituations":"Serialization bugs where the threshold becomes null; booleans used as 0/1 substitutes; nested objects passed by mistake.","solutions":["Send the threshold as a JSON number or numeric string","Guard the value is a number before building the query"],"exampleFix":"// before\n{\"name\":\"cutOffMax\",\"args\":[true]}\n// after\n{\"name\":\"cutOffMax\",\"args\":[100]}","handlingStrategy":"type-guard","validationCode":"switch f.Args[0].(type) { case float64, string: default: return errors.New(\"threshold must be number or numeric string\") }","typeGuard":"func isNumericLike(a interface{}) bool { switch a.(type) { case float64, string: return true }; return false }","tryCatchPattern":null,"preventionTips":["Never send booleans/nulls as thresholds","Serialize thresholds as numbers"],"tags":["signoz","query-builder","cutoff","type-mismatch"],"backgroundTag":"query-validation-failed","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}