{"record":{"id":"e99da3c5941bf672","repo":"apache/skywalking","slug":"unsupported-step","errorCode":null,"errorMessage":"Unsupported step: {}","messagePattern":"Unsupported step: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"oap-server/mqe-rt/src/main/java/org/apache/skywalking/mqe/rt/operation/TrendOp.java","lineNumber":94,"sourceCode":"\n    private static ExpressionResult calculateRate(ExpressionResult expResult, int trendRange, Step step) {\n        ExpressionResult result = calculateIncrease(expResult, trendRange);\n        long rangeSeconds;\n        switch (step) {\n            case SECOND:\n                rangeSeconds = trendRange;\n                break;\n            case MINUTE:\n                rangeSeconds = trendRange * 60;\n                break;\n            case HOUR:\n                rangeSeconds = trendRange * 3600;\n                break;\n            case DAY:\n                rangeSeconds = trendRange * 86400;\n                break;\n            default:\n                throw new IllegalArgumentException(\"Unsupported step: \" + step);\n        }\n        result.getResults().forEach(resultValues -> {\n            resultValues.getValues().forEach(mqeValue -> {\n                if (!mqeValue.isEmptyValue()) {\n                    double newValue = mqeValue.getDoubleValue() / rangeSeconds;\n                    mqeValue.setDoubleValue(newValue);\n                }\n            });\n        });\n        return result;\n    }\n}\n","sourceCodeStart":76,"sourceCodeEnd":107,"githubUrl":"https://github.com/apache/skywalking/blob/102af09b4a56064e22050dded10e2c52e490d040/oap-server/mqe-rt/src/main/java/org/apache/skywalking/mqe/rt/operation/TrendOp.java#L76-L107","documentation":"TrendOp.calculateRate divides increase values by a range in seconds derived from the query Step; only SECOND, MINUTE, HOUR and DAY are handled. Any other Step constant hits the default branch and throws IllegalArgumentException (note: NOT IllegalExpressionException — a plain runtime exception, and the message is built by string concatenation, matching '{}'-style formatting only loosely).","triggerScenarios":"Calling rate(metric, range) when the query's Step resolves to something outside SECOND/MINUTE/HOUR/DAY — e.g. a new Step enum constant added to server-core without updating TrendOp, or programmatic MQE evaluation with a custom/placeholder Step.","commonSituations":"OAP version skew where Step gained new constants (e.g. a week-level step) but mqe-rt predates it; custom code invoking the rate evaluation path with an uninitialized Step; queries constructed via internal APIs rather than the GraphQL query API which normalizes step.","solutions":["Query with a standard step (SECOND, MINUTE, HOUR, or DAY) via the normal metrics query API","If a new Step constant is required, add its case (seconds multiplier) to the switch in TrendOp.calculateRate and rebuild mqe-rt","Ensure the whole OAP server (server-core and mqe-rt) is deployed as one coherent version","When calling MQE evaluation programmatically, always set an explicit valid Step on the query context"],"exampleFix":"// before\n// internal evaluation with a placeholder/custom step\nstep = Step.WEEK; // no case in TrendOp -> IllegalArgumentException\n// after\nstep = Step.DAY;","handlingStrategy":"validation","validationCode":"if (step != Step.SECOND && step != Step.MINUTE && step != Step.HOUR && step != Step.DAY) {\n    throw new IllegalArgumentException(\"Step must be SECOND/MINUTE/HOUR/DAY for rate()\");\n}","typeGuard":"boolean isRateSupportedStep(Step s) {\n    return s == Step.SECOND || s == Step.MINUTE || s == Step.HOUR || s == Step.DAY;\n}","tryCatchPattern":"catch (IllegalArgumentException e) { /* note: NOT IllegalExpressionException — this one escapes the MQE error channel; guard the step up front */ }","preventionTips":["Always set an explicit standard Step on the query context before evaluating rate()","When adding new Step constants upstream, update the switch in TrendOp.calculateRate in the same change","Remember this exception type differs from the other MQE errors — generic IllegalExpressionException handlers will not catch it"],"tags":["mqe","query-engine","trend","step","illegal-argument"],"backgroundTag":null,"analyzedSha":"102af09b4a56064e22050dded10e2c52e490d040","analyzedAt":"2026-08-14T10:47:52.647Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}