SigNoz/signoz · error
aggregate attribute is required
Error message
aggregate attribute is required
What it means
When the aggregate operator requires an attribute (e.g. rate, histogram, percentile ops on logs/traces) but AggregateAttribute is the zero AttributeKey, validation fails.
Source
Thrown at pkg/query-service/model/v3/v3.go:1058
// } 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 {
if err := b.SecondaryAggregation.Validate(); err != nil {
return fmt.Errorf("series aggregation is required for value type panel with group by: %w", err)
}
}View on GitHub (pinned to 5069bf80b0)
Solutions
- Set aggregateAttribute with at least key and type/dataType
- Or switch to an operator that doesn't require an attribute (noop/count)
Example fix
// before
{"aggregateOperator":"rate"}
// after
{"aggregateOperator":"rate","aggregateAttribute":{"key":"durationNano","type":"tag","dataType":"float64"}} Defensive patterns
Strategy: validation
Validate before calling
if q.AggregateOperator.RequireAttribute(q.DataSource) && q.AggregateAttribute == (v3.AttributeKey{}) {
return errors.New("aggregateAttribute required")
} Type guard
func hasAggregateAttribute(q v3.BuilderQuery) bool { return q.AggregateAttribute != v3.AttributeKey{} } Prevention
- Pair attribute-requiring operators with an attribute in the query builder UI
When it happens
Trigger: A logs/traces builder query using an operator that needs an attribute (per RequireAttribute) with no aggregateAttribute set.
Common situations: Copying a metrics query shape to logs without specifying which attribute to aggregate over.
Understand the failure class
Background: "Missing required field" and "field is required" errors: why libraries reject payloads that omit mandatory fields — this error's family across 20 libraries.
Related errors
- query name is required
- expression is required
- CodeInvalidInput
- ErrCodeIncorrectPassword
- CodeTooManyRequests
AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28).
Data as JSON: /api/errors/007acbf26dc42967.
Report an issue: GitHub.