apache/skywalking · error · IllegalExpressionException

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

Error message

Bool Operation: The result of the right expression is not 1 or 0.

What it means

IllegalExpressionException from BoolOp.boolOp: the right operand's scalar value is not 1 or 0. Mirror of the left-side check; the code marks both as defensive ('just in case') since boolean results should already be normalized, so hitting it points at invariant breakage or drift, not ordinary expression authoring.

Source

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

            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;
                }
            case MQEParser.OR:
                if (leftValue == 1 || rightValue == 1) {
                    return 1;
                } else {
                    return 0;
                }
            default:
                throw new IllegalExpressionException("Unsupported bool operation.");
        }
    }

View on GitHub (pinned to 102af09b4a)

Solutions

  1. Rebuild/redeploy with consistent OAP versions across mqe-rt and server-core
  2. Verify compare-producing sub-expressions return 0/1 by testing each leaf alone
  3. Guard against NaN inputs: filter empty values first (e.g. with appropriate MQE filtering) before boolean combination
  4. Report with full expression + stack if seen on an unmodified release
Defensive patterns

Strategy: try-catch

Try / catch

catch (IllegalExpressionException e) { /* same as left-side: check version consistency and normalization; report if stock */ }

Prevention

When it happens

Trigger: Right-hand scalar of a && / || evaluating to something other than 0/1 — via non-normalized compare results from mismatched module versions, fork modifications, or NaN/Infinity slipping through value extraction.

Common situations: Same as the left-side variant: mixed-version deployments, custom compare implementations, NaN metrics feeding comparisons; distinct from error 72/73 which are the user-facing 'not a compare result' checks.

Related errors


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