apache/skywalking · error · IllegalExpressionException

Bool Operation: The result of the right expression is not a

Error message

Bool Operation: The result of the right expression is not a compare result.

What it means

IllegalExpressionException from BoolOp.doBoolOp: symmetric twin of the left-side check — the right operand of && / || has isBoolResult() == false, so it is not the result of a comparison and cannot participate in boolean logic.

Source

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

 */

package org.apache.skywalking.mqe.rt.operation;

import org.apache.skywalking.mqe.rt.exception.IllegalExpressionException;
import org.apache.skywalking.mqe.rt.grammar.MQEParser;
import org.apache.skywalking.oap.server.core.query.mqe.ExpressionResult;

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.");

View on GitHub (pinned to 102af09b4a)

Solutions

  1. Add the missing comparison to the right operand
  2. Re-read the whole && / || chain and confirm every leaf is of the form 'X <op> Y'
  3. Use the UI MQE preview to validate the boolean expression before saving the dashboard

Example fix

# before
service_sla > 1000 && service_cpm
# after
service_sla > 1000 && service_cpm > 0
Defensive patterns

Strategy: validation

Validate before calling

boolean isBoolLeaf(ExpressionResult r) { return r.isBoolResult(); } // apply to the right operand too

Type guard

boolean isCompareResult(org.apache.skywalking.oap.server.core.query.mqe.ExpressionResult r) {
    return r.isBoolResult();
}

Prevention

When it happens

Trigger: 'service_sla > 1000 && service_cpm' — the right side is a raw metric value with no comparison, so checkExpression(right) fails before evaluation.

Common situations: Same class as the left-side error: truncated boolean chains, dashboard-template generation that drops the trailing comparison, or editing a working condition and deleting the '> N' part.

Related errors


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