{"record":{"id":"884748862842ef0e","repo":"apache/skywalking","slug":"bool-operation-the-result-of-the-right-expression-884748","errorCode":null,"errorMessage":"Bool Operation: The result of the right expression is not 1 or 0.","messagePattern":"Bool Operation: The result of the right expression is not 1 or 0\\.","errorType":"exception","errorClass":"IllegalExpressionException","httpStatus":null,"severity":"error","filePath":"oap-server/mqe-rt/src/main/java/org/apache/skywalking/mqe/rt/operation/BoolOp.java","lineNumber":53,"sourceCode":"            throw new IllegalExpressionException(\n                \"Bool Operation: The result of the right expression is not a compare result.\");\n        }\n\n        try {\n            return LROp.doLROp(left, right, opType, BoolOp::boolOp);\n        } catch (IllegalExpressionException e) {\n            throw new IllegalExpressionException(\"Unsupported bool operation: \" + e.getMessage());\n        }\n    }\n\n    //bool with bool\n    private static double boolOp(double leftValue, double rightValue, int opType) throws IllegalExpressionException {\n        // this should not happen, but just in case\n        if (!checkBool(leftValue)) {\n            throw new IllegalExpressionException(\"Bool Operation: The result of the left expression is not 1 or 0.\");\n        }\n        if (!checkBool(rightValue)) {\n            throw new IllegalExpressionException(\"Bool Operation: The result of the right expression is not 1 or 0.\");\n        }\n        switch (opType) {\n            case MQEParser.AND:\n                if (leftValue == 1 && rightValue == 1) {\n                    return 1;\n                } else {\n                    return 0;\n                }\n            case MQEParser.OR:\n                if (leftValue == 1 || rightValue == 1) {\n                    return 1;\n                } else {\n                    return 0;\n                }\n            default:\n                throw new IllegalExpressionException(\"Unsupported bool operation.\");\n        }\n    }","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/apache/skywalking/blob/102af09b4a56064e22050dded10e2c52e490d040/oap-server/mqe-rt/src/main/java/org/apache/skywalking/mqe/rt/operation/BoolOp.java#L35-L71","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Rebuild/redeploy with consistent OAP versions across mqe-rt and server-core","Verify compare-producing sub-expressions return 0/1 by testing each leaf alone","Guard against NaN inputs: filter empty values first (e.g. with appropriate MQE filtering) before boolean combination","Report with full expression + stack if seen on an unmodified release"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (IllegalExpressionException e) { /* same as left-side: check version consistency and normalization; report if stock */ }","preventionTips":["Deploy one consistent OAP build","Filter NaN/empty values before comparisons","Report reproducible cases upstream with the expression"],"tags":["mqe","boolean","internal","invariant","version-mismatch"],"backgroundTag":null,"analyzedSha":"102af09b4a56064e22050dded10e2c52e490d040","analyzedAt":"2026-08-14T10:47:52.647Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}