{"record":{"id":"e55f01e91ffde06c","repo":"SigNoz/signoz","slug":"series-aggregation-is-required-for-value-type-pane","errorCode":null,"errorMessage":"series aggregation is required for value type panel with group by: %w","messagePattern":"series aggregation is required for value type panel with group by: %w","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/query-service/model/v3/v3.go","lineNumber":1074,"sourceCode":"\t\t}\n\t\tif b.AggregateAttribute == (AttributeKey{}) && b.AggregateOperator.RequireAttribute(b.DataSource) {\n\t\t\treturn fmt.Errorf(\"aggregate attribute is required\")\n\t\t}\n\t}\n\n\tif b.Filters != nil {\n\t\tif err := b.Filters.Validate(); err != nil {\n\t\t\treturn fmt.Errorf(\"filters are invalid: %w\", err)\n\t\t}\n\t}\n\tif b.GroupBy != nil {\n\t\t// if len(b.GroupBy) > 0 && panelType == PanelTypeList {\n\t\t// \treturn fmt.Errorf(\"group by is not supported for list panel type\")\n\t\t// }\n\n\t\tif panelType == PanelTypeValue && len(b.GroupBy) > 0 {\n\t\t\tif err := b.SecondaryAggregation.Validate(); err != nil {\n\t\t\t\treturn fmt.Errorf(\"series aggregation is required for value type panel with group by: %w\", err)\n\t\t\t}\n\t\t}\n\n\t\tfor _, groupBy := range b.GroupBy {\n\t\t\tif err := groupBy.Validate(); err != nil {\n\t\t\t\treturn fmt.Errorf(\"group by is invalid %w\", err)\n\t\t\t}\n\t\t}\n\n\t\tif b.DataSource == DataSourceMetrics && len(b.GroupBy) > 0 && b.SpaceAggregation == SpaceAggregationUnspecified {\n\t\t\tif b.AggregateOperator == AggregateOperatorNoOp || b.AggregateOperator == AggregateOperatorRate {\n\t\t\t\treturn fmt.Errorf(\"group by requires aggregate operator other than noop or rate\")\n\t\t\t}\n\t\t}\n\t}\n\n\tif b.Having != nil {\n\t\tfor _, having := range b.Having {","sourceCodeStart":1056,"sourceCodeEnd":1092,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/model/v3/v3.go#L1056-L1092","documentation":"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.","triggerScenarios":"panelType=value with groupBy=[\"service\"] and no secondaryAggregation (or an invalid one), producing error via SecondaryAggregation.Validate.","commonSituations":"Building stat/value widgets grouped by a dimension; the UI usually sets seriesAggregation automatically but API calls often miss it.","solutions":["Set secondaryAggregation to sum/avg/min/max on value panels with group by","Or remove group by if you want a single aggregate value","Alternatively use space aggregation across the group if semantics allow"],"exampleFix":"// before\n{\"panelType\":\"value\",\"builderQueries\":{\"A\":{\"groupBy\":[{\"key\":\"service\"...}]}}}\n// after\n{\"panelType\":\"value\",\"builderQueries\":{\"A\":{\"groupBy\":[{\"key\":\"service\"...}],\"secondaryAggregation\":\"avg\"}}}","handlingStrategy":"validation","validationCode":"if panelType == v3.PanelTypeValue && len(q.GroupBy) > 0 {\n\tif q.SecondaryAggregation == \"\" { return errors.New(\"set secondaryAggregation (sum/avg/min/max)\") }\n\tif err := q.SecondaryAggregation.Validate(); err != nil { return err }\n}","typeGuard":"func valuePanelNeedsSeriesAgg(p v3.PanelType, q v3.BuilderQuery) bool { return p == v3.PanelTypeValue && len(q.GroupBy) > 0 }","tryCatchPattern":null,"preventionTips":["Default secondaryAggregation to 'sum' in value-panel templates"],"tags":["go","panel-type","series-aggregation"],"backgroundTag":"query-payload-validation-failed","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}