{"record":{"id":"e35348e5946d1b73","repo":"apache/skywalking","slug":"unsupported-aggregation-operation","errorCode":null,"errorMessage":"Unsupported aggregation operation.","messagePattern":"Unsupported aggregation operation\\.","errorType":"exception","errorClass":"IllegalExpressionException","httpStatus":null,"severity":"error","filePath":"oap-server/mqe-rt/src/main/java/org/apache/skywalking/mqe/rt/operation/AggregationOp.java","lineNumber":79,"sourceCode":"                                                                  .max(Comparator.comparingDouble(\n                                                                      MQEValue::getDoubleValue)));\n            case MQEParser.MIN:\n                return selectResult(result, mqeValues -> mqeValues.getValues()\n                                                                  .stream()\n                                                                  .filter(mqeValue -> !mqeValue.isEmptyValue())\n                                                                  .min(Comparator.comparingDouble(\n                                                                      MQEValue::getDoubleValue)));\n            case MQEParser.SUM:\n                return aggregateResult(result, mqeValues -> OptionalDouble.of(mqeValues.getValues()\n                                                                                       .stream()\n                                                                                       .filter(\n                                                                                           mqeValue -> !mqeValue.isEmptyValue())\n                                                                                       .flatMapToDouble(\n                                                                                           mqeValue -> DoubleStream.of(\n                                                                                               mqeValue.getDoubleValue()))\n                                                                                       .sum()));\n            default:\n                throw new IllegalExpressionException(\"Unsupported aggregation operation.\");\n        }\n    }\n\n    private static ExpressionResult aggregateResult(ExpressionResult result,\n                                                    Function<MQEValues, OptionalDouble> aggregator) {\n        for (MQEValues resultValues : result.getResults()) {\n            OptionalDouble resultValue = aggregator.apply(resultValues);\n            List<MQEValue> mqeValueList = new ArrayList<>(1);\n            //no id\n            MQEValue mqeValue = new MQEValue();\n            if (resultValue.isPresent()) {\n                mqeValue.setEmptyValue(false);\n                mqeValue.setDoubleValue(resultValue.getAsDouble());\n            } else {\n                mqeValue.setEmptyValue(true);\n            }\n            mqeValueList.add(mqeValue);\n            resultValues.setValues(mqeValueList);","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/apache/skywalking/blob/102af09b4a56064e22050dded10e2c52e490d040/oap-server/mqe-rt/src/main/java/org/apache/skywalking/mqe/rt/operation/AggregationOp.java#L61-L97","documentation":"IllegalExpressionException from AggregationOp's dispatch switch: the aggregation token applied to an expression is not one of AVG, COUNT, LATEST, MAX, MIN or SUM. The grammar tokenized successfully but the runtime has no implementation for it, so evaluation is refused.","triggerScenarios":"Any aggregation function name in an MQE expression outside the implemented set — e.g. 'median(...)', 'stddev(...)', 'rate(...)' used where an aggregation is expected, or a token produced by grammar/runtime version drift between UI and OAP.","commonSituations":"UI from a newer SkyWalking version emitting an aggregation the older OAP backend lacks; users porting PromQL aggregations (quantile, stddev) into MQE; typos in function names that still lex as identifiers.","solutions":["Swap the function for a supported one: AVG, COUNT, LATEST, MAX, MIN, or SUM","Check the MQE docs for the deployed OAP version and use only listed aggregations","If UI/OAP versions are mixed, align them (skywalking-ui submodule version vs OAP release)","For percentile needs, use the dedicated percentile syntax (metric.p99(dt5m)) instead of an aggregation function"],"exampleFix":"# before\nmedian(service_resp_time.sum(dt5m))\n# after\nservice_resp_time.p99(dt5m)","handlingStrategy":"validation","validationCode":"private static final Set<String> AGGREGATIONS = Set.of(\"AVG\", \"COUNT\", \"LATEST\", \"MAX\", \"MIN\", \"SUM\");\nvoid assertAggregation(String f) {\n    if (!AGGREGATIONS.contains(f.toUpperCase(Locale.ROOT))) throw new IllegalArgumentException(\"Unsupported aggregation: \" + f);\n}","typeGuard":"boolean isSupportedAggregation(String f) {\n    return f != null && java.util.Set.of(\"AVG\",\"COUNT\",\"LATEST\",\"MAX\",\"MIN\",\"SUM\").contains(f.toUpperCase(Locale.ROOT));\n}","tryCatchPattern":null,"preventionTips":["Use only documented aggregations for your OAP version","Use percentile syntax metric.pNN(dt) instead of aggregation functions for percentiles","Keep UI and OAP versions aligned"],"tags":["mqe","aggregation","unsupported-operation","query"],"backgroundTag":null,"analyzedSha":"102af09b4a56064e22050dded10e2c52e490d040","analyzedAt":"2026-08-14T10:47:52.647Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}