SigNoz/signoz · error
invalid operator: %s
Error message
invalid operator: %s
What it means
Thrown by AggregateOperator.Validate() in pkg/query-service/model/v3/v3.go when the aggregate operator string is not one of the recognized constants (sum, avg, min, max, p05/p10/.../p99 percentiles, rate_sum, rate_avg, rate_min, rate_max, hist_quant50/75/90/95/99, etc.). It is a plain enum validation: the API received an operator value it cannot map to a ClickHouse aggregation.
Source
Thrown at pkg/query-service/model/v3/v3.go:109
AggregateOperatorP95,
AggregateOperatorP99,
AggregateOperatorRate,
AggregateOperatorSumRate,
AggregateOperatorAvgRate,
AggregateOperatorMinRate,
AggregateOperatorMaxRate,
AggregateOperatorRateSum,
AggregateOperatorRateAvg,
AggregateOperatorRateMin,
AggregateOperatorRateMax,
AggregateOperatorHistQuant50,
AggregateOperatorHistQuant75,
AggregateOperatorHistQuant90,
AggregateOperatorHistQuant95,
AggregateOperatorHistQuant99:
return nil
default:
return fmt.Errorf("invalid operator: %s", a)
}
}
// RequireAttribute returns true if the aggregate operator requires an attribute
// to be specified.
func (a AggregateOperator) RequireAttribute(dataSource DataSource) bool {
switch dataSource {
case DataSourceMetrics:
switch a {
case AggregateOperatorNoOp,
AggregateOperatorCount:
return false
default:
return true
}
case DataSourceLogs:
switch a {
case AggregateOperatorNoOp,View on GitHub (pinned to 5069bf80b0)
Solutions
- Check the AggregateOperator constants in pkg/query-service/model/v3/v3.go for the exact accepted spellings and use one of them (lowercase, e.g. "avg", "p95", "hist_quant99")
- Ensure JSON payloads use the exact enum string values; Go unmarshals case-sensitively for string-typed constants
- If the value comes from user input, validate it client-side against the operator list before sending the request
- If you need an operator you believe exists, upgrade the query-service to a version that supports it
Example fix
// before
req := &v3.AggregateAttributeRequest{
AggregateOperator: v3.AggregateOperator("P95"),
}
// after
req := &v3.AggregateAttributeRequest{
AggregateOperator: v3.AggregateOperatorP95,
} Defensive patterns
Strategy: validation
Validate before calling
validOps := map[v3.AggregateOperator]bool{v3.AggregateOperatorAvg:true,v3.AggregateOperatorSum:true,v3.AggregateOperatorMin:true,v3.AggregateOperatorMax:true,v3.AggregateOperatorP95:true} // extend as needed
if !validOps[req.AggregateOperator] { return fmt.Errorf("unsupported operator %q", req.AggregateOperator) } Type guard
func isValidAggregateOperator(op v3.AggregateOperator) bool { return op != "" && op == v3.AggregateOperator(strings.ToLower(string(op))) && knownOps[op] } Prevention
- Always use the exported v3.AggregateOperator constants instead of raw strings
- Build operator pickers in the UI from a list generated from the same constants
When it happens
Trigger: Calling a v3 query API (e.g. POST /api/v3/query_range or autocomplete/aggregate-attribute endpoints) with QueryData.AggregateAttributeRequest.AggregateOperator set to a typo'd or unsupported value like "Sum", "count_distinct", "p50", or an empty string when the data source is not metrics.
Common situations: Frontend/CLI sending capitalized operator names, version skew where a newer client emits an operator this server build doesn't know yet, hand-crafted JSON payloads, or copy-pasting operator names from a different metrics DSL (PromQL function names like 'quantile' used as operator).
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- invalid reduce to operator: %s
- invalid query type: %s
- invalid panel type: %s
- invalid tag type: %s
- invalid tag data type: %s
AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28).
Data as JSON: /api/errors/a68f6a0cd0406e2c.
Report an issue: GitHub.