{"record":{"id":"263063cd73a58ad9","repo":"apache/skywalking","slug":"rank-rank-doesn-t-exist-in-the-previous-ranks-r-263063","errorCode":null,"errorMessage":"Rank {rank} doesn't exist in the previous ranks {ranks}","messagePattern":"Rank (.+?) doesn't exist in the previous ranks (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/meter/function/sum/SumHistogramPercentileFunction.java","lineNumber":119,"sourceCode":"                    \"Incompatible BucketedValues [\" + value + \"] for current PercentileFunction[\" + summation + \"]\");\n            }\n        }\n\n        for (final int rank : value.getRanks()) {\n            if (rank <= 0) {\n                throw new IllegalArgumentException(\"Illegal rank value \" + rank + \", must be positive\");\n            }\n        }\n\n        if (ranks.size() > 0) {\n            if (ranks.size() != value.getRanks().length) {\n                throw new IllegalArgumentException(\n                    \"Incompatible ranks size = [\" + value.getRanks().length + \"] for current PercentileFunction[\" + ranks\n                        .size() + \"]\");\n            } else {\n                for (final int rank : value.getRanks()) {\n                    if (!ranks.include(rank)) {\n                        throw new IllegalArgumentException(\n                            \"Rank \" + rank + \" doesn't exist in the previous ranks \" + ranks);\n                    }\n                }\n            }\n        } else {\n            for (final int rank : value.getRanks()) {\n                ranks.add(rank);\n            }\n        }\n\n        this.entityId = entity.id();\n\n        String template = \"%s\";\n        if (CollectionUtils.isNotEmpty(value.getBucketedValues().getLabels())) {\n            template  = value.getBucketedValues().getLabels() + \":%s\";\n        }\n        final long[] values = value.getBucketedValues().getValues();\n        for (int i = 0; i < values.length; i++) {","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/apache/skywalking/blob/102af09b4a56064e22050dded10e2c52e490d040/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/meter/function/sum/SumHistogramPercentileFunction.java#L101-L137","documentation":"Once the rank set of a sum_histogram_percentile metric is locked in the current time window, SumHistogramPercentileFunction checks each incoming rank with ranks.include(rank). This branch fires when the count matches but a specific rank value is not in the locked set — e.g. locked [50,75,90] receives [50,75,95].","triggerScenarios":"A later input in the same window passes a rank value that was not in the first-accepted rank list, while the total count happens to match.","commonSituations":"Changing one percentile value (90 -> 95) in MAL config during a rolling upgrade; two agents with different firmware versions reporting the same metric name.","solutions":["Align all rank values exactly across every producer of the metric","Restart all OAP nodes together after the config change so a fresh window locks the new ranks","Treat the percentile rank list as part of the metric contract: change it only with a coordinated rollout or a new metric name"],"exampleFix":"# before — first window input locks {50,75,90}, later input sends {50,75,95}\n# after — all inputs use {50,75,90,99}\npercentile(50, 75, 90, 99) -> sum_histogram_percentile","handlingStrategy":"validation","validationCode":"IntList locked = function.getRanks();\nint[] incoming = argument.getRanks();\nif (locked.size() > 0 && Arrays.stream(incoming).anyMatch(r -> !locked.include(r))) {\n    log.warn(\"Rank {} not in locked set {}; dropping\", Arrays.toString(incoming), locked);\n    return;\n}","typeGuard":null,"tryCatchPattern":"Catch IllegalArgumentException around accept(), log both rank sets, drop the sample; alert if mismatches persist across windows (indicates config drift, not a transient).","preventionTips":["Version your meter configs and make rank lists part of the versioned contract","During rolling upgrades, drain/finish the current window before activating new rank configs","Monitor OAP logs for this message as a config-drift signal"],"tags":["meter-function","mal","percentile","metric-config","validation"],"backgroundTag":null,"analyzedSha":"102af09b4a56064e22050dded10e2c52e490d040","analyzedAt":"2026-08-14T10:47:52.647Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}