SigNoz/signoz · error

function name is invalid: %w

Error message

function name is invalid: %w

What it means

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.

Source

Thrown at pkg/query-service/model/v3/v3.go:1112

				return fmt.Errorf("having operator is invalid: %w", err)
			}
		}
	}

	for _, selectColumn := range b.SelectColumns {
		if err := selectColumn.Validate(); err != nil {
			return fmt.Errorf("select column is invalid %w", err)
		}
	}

	if b.Expression == "" {
		return fmt.Errorf("expression is required")
	}

	if len(b.Functions) > 0 {
		for _, function := range b.Functions {
			if err := function.Name.Validate(); err != nil {
				return fmt.Errorf("function name is invalid: %w", err)
			}
			if function.Name == FunctionNameTimeShift {
				if len(function.Args) == 0 {
					return fmt.Errorf("timeShiftBy param missing in query")
				}
				_, ok := function.Args[0].(float64)
				if !ok {
					// if string, attempt to convert to float
					timeShiftBy, err := strconv.ParseFloat(function.Args[0].(string), 64)
					if err != nil {
						return fmt.Errorf("timeShiftBy param should be a number")
					}
					function.Args[0] = timeShiftBy
				}
			} else if function.Name == FunctionNameEWMA3 ||
				function.Name == FunctionNameEWMA5 ||
				function.Name == FunctionNameEWMA7 {
				if len(function.Args) == 0 {

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. 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
  2. Compare against the supported function list for your SigNoz backend version; remove or replace functions not present
  3. Re-save the dashboard/alert after editing the query so the corrected payload is persisted

Example fix

// before
"functions": [{"name": "timeshift", "args": [3600]}]
// after
"functions": [{"name": "timeShift", "args": [3600]}]
Defensive patterns

Strategy: validation

Validate before calling

var validFn = map[string]bool{"timeShift":true,"EWMA3":true,"EWMA5":true,"EWMA7":true,"cutOffMax":true,"cutOffMin":true,"clampMax":true,"clampMin":true}
for _, f := range q.Filters[0].Function { if !validFn[f.Name] { return fmt.Errorf("unsupported function %q", f.Name) } }

Type guard

func isValidFunctionName(n v3.FunctionName) bool { return n.Validate() == nil }

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28). Data as JSON: /api/errors/45d53de9a908782d. Report an issue: GitHub.