{"record":{"id":"978ea4d6c6aaa771","repo":"SigNoz/signoz","slug":"unsupported-aggregate-operator-s-for-paneltype-s","errorCode":null,"errorMessage":"unsupported aggregate operator %s for panelType %s","messagePattern":"unsupported aggregate operator (.+?) for panelType (.+?)","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/query-service/app/traces/v4/query_builder.go","lineNumber":349,"sourceCode":"\t\t\t\twithSubQuery := fmt.Sprintf(withSubQueryWithLimits, constants.SIGNOZ_TRACE_DBNAME, constants.SIGNOZ_SPAN_INDEX_V3_LOCAL_TABLENAME, timeFilter, filterSubQuery)\n\t\t\t\tafterSubQuery := tracesV3.AddLimitToQuery(constants.TraceExplorerSpanCountAfterSubQuery, mq.Limit)\n\t\t\t\tif mq.Offset != 0 {\n\t\t\t\t\tafterSubQuery = tracesV3.AddOffsetToQuery(afterSubQuery, mq.Offset)\n\t\t\t\t}\n\t\t\t\tquery = fmt.Sprintf(constants.TraceExplorerSpanCountBeforeSubQuery, constants.SIGNOZ_TRACE_DBNAME, constants.SIGNOZ_SPAN_INDEX_V3) + withSubQuery + \") \" + fmt.Sprintf(afterSubQuery, constants.SIGNOZ_TRACE_DBNAME, constants.SIGNOZ_SPAN_INDEX_V3, timeFilter)\n\t\t\t}\n\t\t\t// adding this to avoid the distributed product mode error which doesn't allow global in\n\t\t\tquery += \" settings distributed_product_mode='allow', max_memory_usage=10000000000\"\n\t\t} else if panelType == v3.PanelTypeList {\n\t\t\tif len(mq.SelectColumns) == 0 {\n\t\t\t\treturn \"\", fmt.Errorf(\"select columns cannot be empty for panelType %s\", panelType)\n\t\t\t}\n\t\t\tselectLabels = getSelectLabels(mq.SelectColumns)\n\t\t\t// add it to the select labels\n\t\t\tqueryNoOpTmpl := fmt.Sprintf(\"SELECT timestamp as timestamp_datetime, span_id as spanID, trace_id as traceID,%s \", selectLabels) + \"from \" + constants.SIGNOZ_TRACE_DBNAME + \".\" + constants.SIGNOZ_SPAN_INDEX_V3 + \" where %s %s\" + \"%s\"\n\t\t\tquery = fmt.Sprintf(queryNoOpTmpl, timeFilter, filterSubQuery, orderBy)\n\t\t} else {\n\t\t\treturn \"\", fmt.Errorf(\"unsupported aggregate operator %s for panelType %s\", mq.AggregateOperator, panelType)\n\t\t}\n\t\treturn query, nil\n\t\t// ---- NOOP ends here ----\n\t}\n\n\thaving := tracesV3.Having(mq.Having)\n\tif having != \"\" {\n\t\thaving = \" having \" + having\n\t}\n\n\tgroupBy := tracesV3.GroupByAttributeKeyTags(panelType, options.GraphLimitQtype, mq.GroupBy...)\n\tif groupBy != \"\" {\n\t\tgroupBy = \" group by \" + groupBy\n\t}\n\n\taggregationKey := \"\"\n\tif mq.AggregateAttribute.Key != \"\" {\n\t\taggregationKey = getColumnName(mq.AggregateAttribute, true)","sourceCodeStart":331,"sourceCodeEnd":367,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/app/traces/v4/query_builder.go#L331-L367","documentation":"In buildTracesQuery's no-op branch, only PanelTypeTrace and PanelTypeList are handled; any other panel type (e.g. graph) combined with the no-op aggregate operator cannot be rendered as a trace query and is rejected.","triggerScenarios":"Sending AggregateOperator=no-op with panelType=graph, table, or value on a traces data source query.","commonSituations":"Switching a panel type in the UI without changing the aggregate operator; API calls copying a list query's structure onto a graph panel.","solutions":["Use an aggregate operator (count, avg(rate) etc.) instead of no-op for non trace/list panel types","Switch the panel type to trace or list if you really need raw no-op behavior"],"exampleFix":"// before\nmq.AggregateOperator = v3.AggregateOperatorNoOp\npanelType = v3.PanelTypeGraph\n\n// after\nmq.AggregateOperator = v3.AggregateOperatorCount\npanelType = v3.PanelTypeGraph","handlingStrategy":"validation","validationCode":"if mq.AggregateOperator == v3.AggregateOperatorNoOp && panelType != v3.PanelTypeTrace && panelType != v3.PanelTypeList {\n    return fmt.Errorf(\"no-op requires trace/list panel, got %s\", panelType)\n}","typeGuard":"func noopAllowed(panelType v3.PanelType) bool {\n    return panelType == v3.PanelTypeTrace || panelType == v3.PanelTypeList\n}","tryCatchPattern":null,"preventionTips":["Recompute aggregate operator when the user switches panel type","Block no-op selection for graph/value panels"],"tags":["signoz","traces","v4","panel-type","aggregate"],"backgroundTag":"unsupported-aggregation-operator","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}