SigNoz/signoz · error

series aggregation is required for value type panel with gro

Error message

series aggregation is required for value type panel with group by: %w

What it means

On a value-type panel with group-by columns, a SecondaryAggregation (series aggregation) must be set and valid because multiple series must be reduced to one number.

Source

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

		}
		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)
			}
		}

		for _, groupBy := range b.GroupBy {
			if err := groupBy.Validate(); err != nil {
				return fmt.Errorf("group by is invalid %w", err)
			}
		}

		if b.DataSource == DataSourceMetrics && len(b.GroupBy) > 0 && b.SpaceAggregation == SpaceAggregationUnspecified {
			if b.AggregateOperator == AggregateOperatorNoOp || b.AggregateOperator == AggregateOperatorRate {
				return fmt.Errorf("group by requires aggregate operator other than noop or rate")
			}
		}
	}

	if b.Having != nil {
		for _, having := range b.Having {

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Set secondaryAggregation to sum/avg/min/max on value panels with group by
  2. Or remove group by if you want a single aggregate value
  3. Alternatively use space aggregation across the group if semantics allow

Example fix

// before
{"panelType":"value","builderQueries":{"A":{"groupBy":[{"key":"service"...}]}}}
// after
{"panelType":"value","builderQueries":{"A":{"groupBy":[{"key":"service"...}],"secondaryAggregation":"avg"}}}
Defensive patterns

Strategy: validation

Validate before calling

if panelType == v3.PanelTypeValue && len(q.GroupBy) > 0 {
	if q.SecondaryAggregation == "" { return errors.New("set secondaryAggregation (sum/avg/min/max)") }
	if err := q.SecondaryAggregation.Validate(); err != nil { return err }
}

Type guard

func valuePanelNeedsSeriesAgg(p v3.PanelType, q v3.BuilderQuery) bool { return p == v3.PanelTypeValue && len(q.GroupBy) > 0 }

Prevention

When it happens

Trigger: panelType=value with groupBy=["service"] and no secondaryAggregation (or an invalid one), producing error via SecondaryAggregation.Validate.

Common situations: Building stat/value widgets grouped by a dimension; the UI usually sets seriesAggregation automatically but API calls often miss it.

Related errors


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