{"record":{"id":"e0f1d89420b67128","repo":"SigNoz/signoz","slug":"unsupported-aggregate-operator-e0f1d8","errorCode":null,"errorMessage":"unsupported aggregate operator","messagePattern":"unsupported aggregate operator","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"pkg/query-service/app/metrics/v3/cumulative_table.go","lineNumber":184,"sourceCode":"\n\t\tquery = fmt.Sprintf(`SELECT %s toStartOfHour(now()) as ts, histogramQuantile(arrayMap(x -> toFloat64(x), groupArray(le)), groupArray(value), %.3f) as value FROM (%s) GROUP BY %s ORDER BY %s ts`, groupTagsWithoutLe, value, query, groupByWithoutLe, orderWithoutLe)\n\t\treturn query, nil\n\tcase v3.AggregateOperatorAvg, v3.AggregateOperatorSum, v3.AggregateOperatorMin, v3.AggregateOperatorMax:\n\t\top := fmt.Sprintf(\"%s(value)\", aggregateOperatorToSQLFunc[mq.AggregateOperator])\n\t\tquery := fmt.Sprintf(queryTmpl, groupTags, op, filterSubQuery, groupBy, orderBy)\n\t\treturn query, nil\n\tcase v3.AggregateOperatorCount:\n\t\top := \"toFloat64(count(*))\"\n\t\tquery := fmt.Sprintf(queryTmpl, groupTags, op, filterSubQuery, groupBy, orderBy)\n\t\treturn query, nil\n\tcase v3.AggregateOperatorCountDistinct:\n\t\top := \"toFloat64(count(distinct(value)))\"\n\t\tquery := fmt.Sprintf(queryTmpl, groupTags, op, filterSubQuery, groupBy, orderBy)\n\t\treturn query, nil\n\tcase v3.AggregateOperatorNoOp:\n\t\treturn \"\", fmt.Errorf(\"noop is not supported for table view\")\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"unsupported aggregate operator\")\n\t}\n}\n","sourceCodeStart":166,"sourceCodeEnd":187,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/app/metrics/v3/cumulative_table.go#L166-L187","documentation":"The switch over AggregateOperator in buildMetricQueryForTable fell through to default, meaning the operator is not one of the known v3 table-view aggregators (sum, avg, max, min, count, count_distinct, *_rate, etc.). Unlike the rate/noop cases, this one means the operator value itself is unrecognized — often a typo, an empty value, or an operator added in a newer/older version than the running query-service.","triggerScenarios":"Passing aggregateOperator like \"p95\", \"rate_sum\", \"\" (empty), or any string not in the v3.AggregateOperator enum for a table query; also a client/server version skew where the client sends a newer operator constant the server doesn't know.","commonSituations":"API payloads hand-rolled without enum validation; older SigNoz query-service receiving queries from a newer frontend; typos in dashboard JSON; enum renamed between versions.","solutions":["Set aggregateOperator to a value from the supported v3 enum (sum, avg, min, max, count, count_distinct, sum_rate, avg_rate, min_rate, max_rate)","Align frontend/client and query-service versions so operator constants match","Validate the operator client-side against the enum before calling the API"],"exampleFix":"// before\n{\"aggregateOperator\":\"rate_sum\",\"queryType\":\"table\"}\n// after\n{\"aggregateOperator\":\"sum_rate\",\"queryType\":\"table\"}","handlingStrategy":"validation","validationCode":"var validOps = map[string]bool{\"sum\":true,\"avg\":true,\"min\":true,\"max\":true,\"count\":true,\"count_distinct\":true,\"rate\":true,\"sum_rate\":true,\"avg_rate\":true,\"min_rate\":true,\"max_rate\":true,\"noop\":true}\nif !validOps[aggregateOperator] {\n  return fmt.Errorf(\"unknown aggregate operator %q\", aggregateOperator)\n}","typeGuard":"func isKnownAggregateOperator(op string) bool { _, ok := validOps[op]; return ok }","tryCatchPattern":"Catch 4xx from the query API, log the operator value, and fail fast with a config error rather than retrying.","preventionTips":["Validate enums client-side before calling the API","Keep frontend and query-service versions aligned","Use generated clients/enums instead of raw strings"],"tags":["signoz","metrics","aggregate-operator","enum-validation"],"backgroundTag":"unsupported-aggregate-operator","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}