{"record":{"id":"45d53de9a908782d","repo":"SigNoz/signoz","slug":"function-name-is-invalid-w","errorCode":null,"errorMessage":"function name is invalid: %w","messagePattern":"function name is invalid: %w","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/query-service/model/v3/v3.go","lineNumber":1112,"sourceCode":"\t\t\t\treturn fmt.Errorf(\"having operator is invalid: %w\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, selectColumn := range b.SelectColumns {\n\t\tif err := selectColumn.Validate(); err != nil {\n\t\t\treturn fmt.Errorf(\"select column is invalid %w\", err)\n\t\t}\n\t}\n\n\tif b.Expression == \"\" {\n\t\treturn fmt.Errorf(\"expression is required\")\n\t}\n\n\tif len(b.Functions) > 0 {\n\t\tfor _, function := range b.Functions {\n\t\t\tif err := function.Name.Validate(); err != nil {\n\t\t\t\treturn fmt.Errorf(\"function name is invalid: %w\", err)\n\t\t\t}\n\t\t\tif function.Name == FunctionNameTimeShift {\n\t\t\t\tif len(function.Args) == 0 {\n\t\t\t\t\treturn fmt.Errorf(\"timeShiftBy 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\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 {","sourceCodeStart":1094,"sourceCodeEnd":1130,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/model/v3/v3.go#L1094-L1130","documentation":"Thrown by QueryBuildQuery.Validate() when a function in the query builder's Functions array fails FunctionName.Validate(). It wraps the underlying validation error, so the message tells you which named aggregation/window function (e.g. timeShift, EWMA, cutOffMin) has an unrecognized or empty name.","triggerScenarios":"Calling Validate() on a BuildQuery v3 payload whose Filters/Functions arrays contain a function whose Name is not one of the known FunctionName constants (typos like 'timeshift' instead of 'timeShift', or a name removed/renamed between SigNoz versions).","commonSituations":"Hand-written JSON query payloads, dashboards or alerts saved with an older function name after an upgrade, or frontend-generated queries referencing a function the backend version doesn't know.","solutions":["Check the exact wrapped error for which function name failed and fix the spelling/case to match the FunctionName constants in pkg/query-service/model/v3","Compare against the supported function list for your SigNoz backend version; remove or replace functions not present","Re-save the dashboard/alert after editing the query so the corrected payload is persisted"],"exampleFix":"// before\n\"functions\": [{\"name\": \"timeshift\", \"args\": [3600]}]\n// after\n\"functions\": [{\"name\": \"timeShift\", \"args\": [3600]}]","handlingStrategy":"validation","validationCode":"var validFn = map[string]bool{\"timeShift\":true,\"EWMA3\":true,\"EWMA5\":true,\"EWMA7\":true,\"cutOffMax\":true,\"cutOffMin\":true,\"clampMax\":true,\"clampMin\":true}\nfor _, f := range q.Filters[0].Function { if !validFn[f.Name] { return fmt.Errorf(\"unsupported function %q\", f.Name) } }","typeGuard":"func isValidFunctionName(n v3.FunctionName) bool { return n.Validate() == nil }","tryCatchPattern":null,"preventionTips":["Validate function names client-side against the backend's supported list","Keep frontend and backend SigNoz versions in sync","Reject queries with unknown functions before sending"],"tags":["signoz","query-builder","validation","functions"],"backgroundTag":"query-validation-failed","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}