SigNoz/signoz · error
aggregate operator is invalid: %w
Error message
aggregate operator is invalid: %w
What it means
For simple builder queries on non-metrics data sources (logs/traces), AggregateOperator.Validate must pass; the value must be in the allowed operator set.
Source
Thrown at pkg/query-service/model/v3/v3.go:1054
// if b.AggregateOperator != "" && b.SpaceAggregation == SpaceAggregationUnspecified {
// if err := b.AggregateOperator.Validate(); err != nil {
// return fmt.Errorf("aggregate operator is invalid: %w", err)
// }
// } else {
// // the time aggregation is not needed for percentile operators
// if !IsPercentileOperator(b.SpaceAggregation) {
// if err := b.TimeAggregation.Validate(); err != nil {
// return fmt.Errorf("time aggregation is invalid: %w", err)
// }
// }
// if err := b.SpaceAggregation.Validate(); err != nil {
// return fmt.Errorf("space aggregation is invalid: %w", err)
// }
// }
} else {
if err := b.AggregateOperator.Validate(); err != nil {
return fmt.Errorf("aggregate operator is invalid: %w", err)
}
}
if b.AggregateAttribute == (AttributeKey{}) && b.AggregateOperator.RequireAttribute(b.DataSource) {
return fmt.Errorf("aggregate attribute is required")
}
}
if b.Filters != nil {
if err := b.Filters.Validate(); err != nil {
return fmt.Errorf("filters are invalid: %w", err)
}
}
if b.GroupBy != nil {
// if len(b.GroupBy) > 0 && panelType == PanelTypeList {
// return fmt.Errorf("group by is not supported for list panel type")
// }
if panelType == PanelTypeValue && len(b.GroupBy) > 0 {View on GitHub (pinned to 5069bf80b0)
Solutions
- Use a valid AggregateOperator constant for the data source
- For metrics with v3 payload, prefer setting spaceAggregation/timeAggregation instead
- Check operator name spelling (e.g. "noop" not "no_op")
Example fix
// before
{"dataSource":"logs","aggregateOperator":"percentile"}
// after
{"dataSource":"logs","aggregateOperator":"avg"} Defensive patterns
Strategy: validation
Validate before calling
if q.DataSource != v3.DataSourceMetrics { if err := q.AggregateOperator.Validate(); err != nil { return err } } Type guard
func isValidAggOp(op v3.AggregateOperator) bool { return op.Validate() == nil } Prevention
- Prefer v3 space/time aggregation fields for metrics
When it happens
Trigger: Logs/traces builder query with an aggregateOperator like "percentile" or an empty/unknown string.
Common situations: Applying metrics-only operators to logs queries, or old v2 payloads with renamed operators.
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
- unsupported aggregate operator
- invalid aggregate operator: %w
- panel type is invalid: %w
- query type is invalid: %w
- invalid time aggregation: %s
AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28).
Data as JSON: /api/errors/9a6b0fd19625f5f2.
Report an issue: GitHub.