apache/skywalking · error · IllegalArgumentException
Incompatible ranks size = [{value.getRanks().length}] for cu
Error message
Incompatible ranks size = [{value.getRanks().length}] for current PercentileFunction[{ranks.size()}] What it means
Once an AvgHistogramPercentileFunction instance has accepted a rank set (ranks is non-empty), every later accept() must supply the exact same rank count — the persisted 'ranks' column and percentile-reading logic are fixed to that set. A differing length throws 'Incompatible ranks size' (and a differing set of equal size throws the adjacent 'Rank ... doesn't exist' error).
Source
Thrown at oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/meter/function/avg/AvgHistogramPercentileFunction.java:134
@Override
public void accept(final MeterEntity entity, final PercentileArgument value) {
if (dataset.size() > 0) {
if (!value.getBucketedValues().isCompatible(dataset)) {
throw new IllegalArgumentException(
"Incompatible BucketedValues [" + value + "] for current PercentileFunction[" + dataset + "]");
}
}
for (final int rank : value.getRanks()) {
if (rank <= 0) {
throw new IllegalArgumentException("Illegal rank value " + rank + ", must be positive");
}
}
if (ranks.size() > 0) {
if (ranks.size() != value.getRanks().length) {
throw new IllegalArgumentException(
"Incompatible ranks size = [" + value.getRanks().length + "] for current PercentileFunction[" + ranks
.size() + "]");
} else {
for (final int rank : value.getRanks()) {
if (!ranks.include(rank)) {
throw new IllegalArgumentException(
"Rank " + rank + " doesn't exist in the previous ranks " + ranks);
}
}
}
} else {
for (final int rank : value.getRanks()) {
ranks.add(rank);
}
}
this.entityId = entity.id();
View on GitHub (pinned to 102af09b4a)
Solutions
- Keep the rank list fixed for the lifetime of the percentile metric name — change ranks only together with a new metric name
- If ranks must change, hot-remove the old metric / restart OAP so the function restarts with an empty ranks state
- Search all rules for the metric name and make the rank lists identical
Example fix
# before — hot-edit adds a rank to an existing metric percentiles: 50,99 # original percentiles: 50,90,99 # edited -> Incompatible ranks size = [3] ... [2] # after — new metric name for the new rank set metric: service_latency_percentile_v2 percentiles: 50,90,99
Defensive patterns
Strategy: validation
Validate before calling
// keep the rank set constant per metric name; validate against the contract before accept
if (!Arrays.equals(ranks, rankContractFor(metricName))) {
log.warn("Rank set changed for {} — use a new metric name or reset state", metricName);
return;
}
percentileMetric.accept(entity, new PercentileArgument(bucketedValues, ranks)); Try / catch
try {
percentileMetric.accept(entity, percentileArgument);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("Incompatible ranks size")
|| e.getMessage().contains("doesn't exist in the previous ranks")) {
log.error("Rank drift on {} — ranks are immutable once accepted", metricName, e);
return;
}
throw e;
} Prevention
- Consider ranks part of the metric identity: to change them, ship a new metric name
- If ranks must change on an existing name, hot-remove the metric or restart OAP so ranks state resets
- Define the percentile list once in shared config and reuse it in every rule referencing the metric
When it happens
Trigger: A MAL percentile rule is edited to add or remove a rank (e.g. 50,99 -> 50,90,99) and re-applied while the metric's in-memory/persisted aggregation still carries the old rank set; two rules emit the same percentile metric with different rank lists.
Common situations: Hot-reloading percentile rules after editing the percentiles list; copy-pasted metric names across rules with diverging rank configs; upgrading a config that added a default rank.
Related errors
- {} has been defined, but calculate function or/are scope typ
- Illegal rank value {rank}, must be positive
- Function {} doesn't inherit from Metrics.
- Incompatible BucketedValues [{}] for current PercentileFunct
- Failed to load MAL rules
AI-assisted analysis of apache/skywalking@102af09b4a (2026-08-14).
Data as JSON: /api/errors/e442d2e391b75d1e.
Report an issue: GitHub.