SigNoz/signoz · error
invalid expression %s: %v
Error message
invalid expression %s: %v
What it means
In query-builder validation, each expression string is compiled with govaluate.NewEvaluableExpressionWithFunctions. If the expression has syntax errors (unbalanced parens, bad tokens, unknown function names not in the allowed funcs map), this error is collected.
Source
Thrown at pkg/query-service/app/parser.go:713
var expressions []string
for _, q := range qp.CompositeQuery.BuilderQueries {
expressions = append(expressions, q.Expression)
}
errs := validateExpressions(expressions, queryBuilder.EvalFuncs, qp.CompositeQuery)
if len(errs) > 0 {
return multierr.Combine(errs...)
}
return nil
}
// validateExpressions validates the math expressions using the list of
// allowed functions.
func validateExpressions(expressions []string, funcs map[string]govaluate.ExpressionFunction, cq *v3.CompositeQuery) []error {
var errs []error
for _, exp := range expressions {
evalExp, err := govaluate.NewEvaluableExpressionWithFunctions(exp, funcs)
if err != nil {
errs = append(errs, fmt.Errorf("invalid expression %s: %v", exp, err))
continue
}
for _, v := range evalExp.Vars() {
var hasVariable bool
for _, q := range cq.BuilderQueries {
if q.Expression == v {
hasVariable = true
break
}
}
if !hasVariable {
errs = append(errs, fmt.Errorf("unknown variable %s", v))
}
}
}
return errs
}
View on GitHub (pinned to 5069bf80b0)
Solutions
- Fix the arithmetic/functional expression syntax (balanced parens, valid operators)
- Verify every function used exists in the allowed functions for your version (see constants/functions docs)
- Test the expression locally with govaluate or in the UI formula box first
Example fix
// before
{"expression": "A +"}
// after
{"expression": "A + B"} Defensive patterns
Strategy: validation
Validate before calling
if _, err := govaluate.NewEvaluableExpressionWithFunctions(expr, allowedFuncs); err != nil { return fmt.Errorf("bad expression: %v", err) } Try / catch
Aggregate the errs slice returned by validateExpressions and show all expression errors at once in the UI/API response.
Prevention
- Compile expressions client-side with a govaluate-equivalent validator
- Lint formulas in the dashboard UI before saving
When it happens
Trigger: POST /api/v3/query_range with a builder query expression like 'A + ' , 'sum(', or using a function not in the allowed function map for your SigNoz version.
Common situations: Hand-crafting formulas in the query builder UI/API; using newly added functions against an older SigNoz; copy-paste introducing smart quotes or invisible characters.
Related errors
- error building clickhouse query: %v
- unknown variable %s
- live tail is only supported for single query
- invalid data type for resource attribute: %s
- unsupported operation, exists and not exists can only be app
AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28).
Data as JSON: /api/errors/ac5e6e7faf192b5d.
Report an issue: GitHub.