apache/skywalking · error · IllegalExpressionException

Series Labeled with Labeled, left and right series value siz

Error message

Series Labeled with Labeled, left and right series value size not equal.

What it means

In LROp.seriesLabeledWithLabeled (both sides labeled TIME_SERIES_VALUES), right label groups are indexed by their label set. For each matched group, the right group's value count must equal the left group's value count (values are paired by index). Unmatched labels are tolerated (left becomes emptyValue), but a matched group with a different length throws.

Source

Thrown at oap-server/mqe-rt/src/main/java/org/apache/skywalking/mqe/rt/operation/LROp.java:304

    }

    private static ExpressionResult seriesLabeledWithLabeled(ExpressionResult seriesLeft,
                                                             ExpressionResult seriesRight,
                                                             int opType, LROp calculate) throws IllegalExpressionException {
        Map<Set<KeyValue>, List<MQEValue>> labelMapR = new HashMap<>();
        seriesRight.getResults().forEach(mqeValuesR -> {
            labelMapR.put(new HashSet<>(mqeValuesR.getMetric().getLabels()), mqeValuesR.getValues());
        });
        for (MQEValues mqeValuesL : seriesLeft.getResults()) {
            for (int i = 0; i < mqeValuesL.getValues().size(); i++) {
                //reserve left metric info, if right metric not exist, set empty value
                MQEValue valueL = mqeValuesL.getValues().get(i);
                List<MQEValue> mqeValuesR = labelMapR.get(new HashSet<>(mqeValuesL.getMetric().getLabels()));
                if (mqeValuesR == null) {
                    valueL.setEmptyValue(true);
                } else {
                    if (mqeValuesR.size() != mqeValuesL.getValues().size()) {
                        throw new IllegalExpressionException("Series Labeled with Labeled, left and right series value size not equal.");
                    }
                    MQEValue valueR = mqeValuesR.get(i);
                    if (valueL.isEmptyValue() || valueR.isEmptyValue()) {
                        valueL.setEmptyValue(true);
                        continue;
                    }
                    double newValue = calculate.apply(valueL.getDoubleValue(), valueR.getDoubleValue(), opType);
                    mqeValuesL.getValues().get(i).setDoubleValue(newValue);
                }
            }
        }

        return seriesLeft;
    }
}

View on GitHub (pinned to 102af09b4a)

Solutions

  1. Query each operand alone; for labels present on both sides, compare value counts and find the mismatched label group
  2. Align step, duration, and down-sampling for both metrics
  3. Drop sparse labels via relabels so only dense, matched groups remain
  4. Do the merge client-side keyed on (labels, timestamp) when server-side index alignment is too strict

Example fix

// before
query: relabels(a, tag:(k,v)) / relabels(b, tag:(k,v))  // point counts differ for (k,v)
// after
query: relabels(a, tag:(k,v)) / relabels(b, tag:(k,v))  // with identical step and aligned buckets on both metrics
Defensive patterns

Strategy: validation

Validate before calling

Map<Set<KeyValue>, Integer> rightSizes = right.getResults().stream()
    .collect(toMap(g -> new HashSet<>(g.getMetric().getLabels()), g -> g.getValues().size()));
boolean ok = left.getResults().stream()
    .allMatch(g -> {
        Integer n = rightSizes.get(new HashSet<>(g.getMetric().getLabels()));
        return n == null || n == g.getValues().size();
    });

Try / catch

catch (IllegalExpressionException e) { /* matched label groups must have equal point counts */ }

Prevention

When it happens

Trigger: 'labeledSeriesA op labeledSeriesB' where a label combination present on both sides has different point counts on each — e.g. one side's series for that label has missing buckets or a different step.

Common situations: Two relabeled metrics whose source series have different cadence for the same label; comparing metrics from different sources (e.g. native SkyWalking metric vs OpenTelemetry-mapped metric) with sparse reporting; gaps introduced by retention/TTl differences per metric.

Related errors


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