{"record":{"id":"c570db7b8fc95007","repo":"SigNoz/signoz","slug":"alpha-param-should-be-a-float","errorCode":null,"errorMessage":"alpha param should be a float","messagePattern":"alpha param should be a float","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/query-service/model/v3/v3.go","lineNumber":1138,"sourceCode":"\t\t\t\t\t// if string, attempt to convert to float\n\t\t\t\t\ttimeShiftBy, 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(\"timeShiftBy param should be a number\")\n\t\t\t\t\t}\n\t\t\t\t\tfunction.Args[0] = timeShiftBy\n\t\t\t\t}\n\t\t\t} else if function.Name == FunctionNameEWMA3 ||\n\t\t\t\tfunction.Name == FunctionNameEWMA5 ||\n\t\t\t\tfunction.Name == FunctionNameEWMA7 {\n\t\t\t\tif len(function.Args) == 0 {\n\t\t\t\t\treturn fmt.Errorf(\"alpha param missing in query\")\n\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\")","sourceCodeStart":1120,"sourceCodeEnd":1156,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/model/v3/v3.go#L1120-L1156","documentation":"EWMA's alpha must arrive as float64 or a string parseable by strconv.ParseFloat. This fires when Args[0] is neither (e.g. a non-numeric string, bool, or nil).","triggerScenarios":"\"args\":[\"zero\"] or [null] or [true] on an EWMA function.","commonSituations":"Form inputs submitting unvalidated text; locale-formatted numbers (\"0,5\"); nulls from optional JSON fields.","solutions":["Send alpha as a JSON number (0.5) or numeric string (\"0.5\")","Validate the input is numeric and within [0,1] client-side before submitting"],"exampleFix":"// before\n{\"name\":\"EWMA3\",\"args\":[\"zero\"]}\n// after\n{\"name\":\"EWMA3\",\"args\":[0.5]}","handlingStrategy":"type-guard","validationCode":"a, err := strconv.ParseFloat(fmt.Sprint(f.Args[0]), 64); if err != nil { return errors.New(\"alpha must be numeric\") }","typeGuard":"func isFloatArg(a interface{}) bool { if _, ok := a.(float64); ok { return true }; s, ok := a.(string); if !ok { return false }; _, err := strconv.ParseFloat(s, 64); return err == nil }","tryCatchPattern":null,"preventionTips":["Send alpha as a JSON number","Parse and validate form input before building queries"],"tags":["signoz","query-builder","ewma","type-mismatch"],"backgroundTag":"query-validation-failed","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}