{"record":{"id":"2e8c76906829cda9","repo":"apache/skywalking","slug":"incompatible-bucketedvalues-for-current-histo","errorCode":null,"errorMessage":"Incompatible BucketedValues [{}] for current HistogramFunction[{}]","messagePattern":"Incompatible BucketedValues \\[(.+?)\\] for current HistogramFunction\\[(.+?)\\]","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/HistogramFunction.java","lineNumber":68,"sourceCode":"    public static final String DATASET = \"dataset\";\n\n    @Setter\n    @Getter\n    @ElasticSearch.EnableDocValues\n    @Column(name = ENTITY_ID, length = 512)\n    @BanyanDB.SeriesID(index = 0)\n    private String entityId;\n    @Getter\n    @Setter\n    @Column(name = DATASET, dataType = Column.ValueDataType.HISTOGRAM, storageOnly = true, defaultValue = 0)\n    @BanyanDB.MeasureField\n    private DataTable dataset = new DataTable(30);\n\n    @Override\n    public void accept(final MeterEntity entity, final BucketedValues value) {\n        if (dataset.size() > 0) {\n            if (!value.isCompatible(dataset)) {\n                throw new IllegalArgumentException(\n                    \"Incompatible BucketedValues [\" + value + \"] for current HistogramFunction[\" + dataset + \"]\");\n            }\n        }\n\n        this.entityId = entity.id();\n\n        final long[] values = value.getValues();\n        for (int i = 0; i < values.length; i++) {\n            final long bucket = value.getBuckets()[i];\n            String bucketName = bucket == Long.MIN_VALUE ? Bucket.INFINITE_NEGATIVE : String.valueOf(bucket);\n            final long bucketValue = values[i];\n            dataset.valueAccumulation(bucketName, bucketValue);\n        }\n    }\n\n    @Override\n    public boolean combine(final Metrics metrics) {\n        HistogramFunction histogram = (HistogramFunction) metrics;","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/apache/skywalking/blob/102af09b4a56064e22050dded10e2c52e490d040/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/meter/function/HistogramFunction.java#L50-L86","documentation":"HistogramFunction.accept() accumulates into a DataTable keyed by bucket names. Once the dataset is non-empty, an incoming BucketedValues must be isCompatible() with the existing dataset — same bucket key set — otherwise the accumulation would mix incommensurable buckets and the throw happens. The message embeds both the incoming value and the current dataset for diagnosis.","triggerScenarios":"The same histogram metric name receives BucketedValues with different bucket sets: e.g. two agents/rules with different bucket configs report the same metric; a MAL rule's buckets were changed and the new values arrive while the old persisted/aggregated dataset is still in memory; one producer includes the Long.MIN_VALUE infinity-negative sentinel bucket and another does not.","commonSituations":"Rolling out a new agent version with different default buckets while OAP keeps aggregating the same metric; multi-tenant setups where different teams configure the same metric name with different valueBuckets; editing MAL otel-rules bucket lists at runtime.","solutions":["Align bucket configuration across every producer of the metric (same valueBuckets / bucket list, including infinity buckets)","If buckets legitimately changed, use a new metric name for the new bucket set, or restart OAP so in-memory datasets reset (persisted data still needs migration/drop)","Standardize bucket templates in shared config so all senders derive buckets identically"],"exampleFix":"# before — two rules emit metric with different buckets\nrule_a: metric m1 buckets: 10,50,100\nrule_b: metric m1 buckets: 20,40,60\n\n# after\nrule_a: metric m1 buckets: 10,50,100\nrule_b: metric m1_v2 buckets: 20,40,60","handlingStrategy":"try-catch","validationCode":"// producer-side: derive buckets from ONE shared config so every emission matches\nlong[] buckets = SharedBucketConfig.bucketsFor(metricName); // single source of truth\nlong[] values = new long[buckets.length];\n// ... fill values ...\nhistogramFunction.accept(entity, new BucketedValues(buckets, values));","typeGuard":null,"tryCatchPattern":"try {\n    histogramMetric.accept(entity, bucketedValues);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"Incompatible BucketedValues\")) {\n        log.error(\"Bucket config drift on {} — align producers or version the metric name\", metricName, e);\n        return; // drop the sample rather than kill the stream worker\n    }\n    throw e;\n}","preventionTips":["Define bucket sets once (shared config/constant) and reference it from every rule and agent profile","Treat bucket boundaries as part of the metric identity — change them only with a new metric name","After fixing a bucket mismatch, restart OAP so in-memory datasets start clean"],"tags":["meter-system","histogram","bucket-mismatch","mal","agent-config"],"backgroundTag":null,"analyzedSha":"102af09b4a56064e22050dded10e2c52e490d040","analyzedAt":"2026-08-14T10:47:52.647Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}