apache/skywalking · error · IllegalExpressionException

Unsupported bool operation: {}

Error message

Unsupported bool operation: {}

What it means

IllegalExpressionException from BoolOp.doBoolOp wrapping the cause of a failed LROp.doLROp call for boolean connectors. The message chain is 'Unsupported bool operation: <cause>' — the cause is either LROp's type-mismatch rejection ('Unsupported operation.') because the two boolean sub-results have incompatible result shapes, or a scalar-level boolOp failure.

Source

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

public class BoolOp {
    public static ExpressionResult doBoolOp(ExpressionResult left,
                                            ExpressionResult right,
                                            int opType) throws IllegalExpressionException {
        if (!checkExpression(left)) {
            throw new IllegalExpressionException(
                "Bool Operation: The result of the left expression is not a compare result.");
        }

        if (!checkExpression(right)) {
            throw new IllegalExpressionException(
                "Bool Operation: The result of the right expression is not a compare result.");
        }

        try {
            return LROp.doLROp(left, right, opType, BoolOp::boolOp);
        } catch (IllegalExpressionException e) {
            throw new IllegalExpressionException("Unsupported bool operation: " + e.getMessage());
        }
    }

    //bool with bool
    private static double boolOp(double leftValue, double rightValue, int opType) throws IllegalExpressionException {
        // this should not happen, but just in case
        if (!checkBool(leftValue)) {
            throw new IllegalExpressionException("Bool Operation: The result of the left expression is not 1 or 0.");
        }
        if (!checkBool(rightValue)) {
            throw new IllegalExpressionException("Bool Operation: The result of the right expression is not 1 or 0.");
        }
        switch (opType) {
            case MQEParser.AND:
                if (leftValue == 1 && rightValue == 1) {
                    return 1;
                } else {
                    return 0;

View on GitHub (pinned to 102af09b4a)

Solutions

  1. Unwrap the cause message to see whether it is a type mismatch or a 1/0 violation, then address that underlying condition
  2. Make both sides of && / || the same result shape (both plain time-series booleans is the safe case)
  3. Reduce labeled results with aggregate_labels before comparing, so both operands are unlabeled booleans
  4. Test each comparison leaf alone in the UI, then combine them only when both render as series

Example fix

# before
(topn(...) > 10) && (service_cpm > 5)
# after
(aggregate_labels(service_cpm, SUM) > 10) && (service_cpm > 5)
Defensive patterns

Strategy: try-catch

Try / catch

catch (IllegalExpressionException e) { /* message = 'Unsupported bool operation: <cause>'; fix the shape mismatch described by <cause> */ }

Prevention

When it happens

Trigger: && / || between boolean results whose ExpressionResultTypes don't combine under LROp's matrix (e.g. a boolean time-series compared with a boolean SORTED_LIST, or labeled vs non-labeled boolean series where pairing fails).

Common situations: Boolean expressions over mixed operand shapes: comparing a TopN-filtered boolean against a series boolean; combining a trend boolean with a scalar boolean produced by aggregation; labeled boolean series whose label sets don't align.

Related errors


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