apache/skywalking · error · IllegalArgumentException

Incompatible BucketedValues

Error message

Incompatible BucketedValues [{}] for current HistogramFunction[{}]

What it means

AvgHistogramFunction (avgHistogram in MAL) keeps summation and count DataTables keyed by bucket name and averages them at calculation time. accept() enforces the same compatibility rule as HistogramFunction: once the dataset is non-empty, incoming BucketedValues must carry the identical bucket key set or the accept is rejected.

Solutions

  1. Pin one bucket definition per metric name and configure all producers (agents, collectors, MAL rules) to use it
  2. Introduce a versioned metric name (e.g. _v2) when bucket boundaries must change, keeping datasets homogeneous
  3. Restart OAP to clear in-memory datasets after fixing the producer config; drop the old persisted model if it holds incompatible keys

Example fix

# before
service_latency_percentile:
  exp: otel...duration.bucket({'10','50','100'})
  meterFunction: avgHistogram
# another producer sends buckets {'20','80'} for the same metric

# after — single bucket set for the metric name across all producers
service_latency_percentile:
  exp: otel...duration.bucket({'10','50','100'})
  meterFunction: avgHistogram
Defensive patterns

Strategy: try-catch

Validate before calling

// before emitting an avgHistogram metric, verify the bucket set matches the metric's contract
if (!Arrays.equals(buckets, expectedBucketsForMetric.get(metricName))) {
    log.warn("Ignoring {} with foreign bucket set {}", metricName, Arrays.toString(buckets));
    return;
}

Try / catch

try {
    avgHistogramMetric.accept(entity, bucketedValues);
} catch (IllegalArgumentException e) {
    if (e.getMessage().contains("Incompatible BucketedValues")) {
        log.error("Bucket drift on avgHistogram metric {}", metricName, e);
        return;
    }
    throw e;
}

Prevention

When it happens

Trigger: An avgHistogram MAL metric is fed BucketedValues whose bucket boundaries differ from those already accumulated — different agent bucket defaults for one metric name, edited valueBuckets in the rule, or the infinity-negative sentinel bucket (Long.MIN_VALUE -> 'InfiniteNegative' key) present in one stream and absent in another.

Common situations: Mixed agent versions reporting the same avgHistogram metric; per-service bucket overrides; OTel collector exporters translating explicit-bucket histograms with changed boundaries.

Related errors


AI-assisted analysis of apache/skywalking@102af09b4a (2026-08-14). Data as JSON: /api/errors/c22c50f431335212. Report an issue: GitHub.

Appendix: source

Thrown at oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/meter/function/avg/AvgHistogramFunction.java:90

    @BanyanDB.MeasureField
    protected DataTable summation = new DataTable(30);
    @Getter
    @Setter
    @Column(name = COUNT, storageOnly = true)
    @ElasticSearch.Column(legacyName = "count")
    @BanyanDB.MeasureField
    protected DataTable count = new DataTable(30);
    @Getter
    @Setter
    @Column(name = DATASET, dataType = Column.ValueDataType.HISTOGRAM, storageOnly = true, defaultValue = 0)
    @BanyanDB.MeasureField
    private DataTable dataset = new DataTable(30);

    @Override
    public void accept(final MeterEntity entity, final BucketedValues value) {
        if (dataset.size() > 0) {
            if (!value.isCompatible(dataset)) {
                throw new IllegalArgumentException(
                    "Incompatible BucketedValues [" + value + "] for current HistogramFunction[" + dataset + "]");
            }
        }

        this.entityId = entity.id();

        final long[] values = value.getValues();
        for (int i = 0; i < values.length; i++) {
            long bucket = value.getBuckets()[i];
            String bucketName = bucket == Long.MIN_VALUE ? Bucket.INFINITE_NEGATIVE : String.valueOf(bucket);
            summation.valueAccumulation(bucketName, values[i]);
            count.valueAccumulation(bucketName, 1L);
        }
    }

    @Override
    public boolean combine(final Metrics metrics) {
        AvgHistogramFunction histogram = (AvgHistogramFunction) metrics;

View on GitHub (pinned to 102af09b4a)