apache/skywalking · error · IllegalExpressionException
Bool Operation: The result of the left expression is not a c
Error message
Bool Operation: The result of the left expression is not a compare result.
What it means
IllegalExpressionException from BoolOp.doBoolOp: boolean connectors (&&, ||) in MQE operate on the results of comparison expressions, and the left operand's ExpressionResult.isBoolResult() is false — i.e. the left side is a plain metric value, not the outcome of a compare operation (>, >=, ==, etc.).
Source
Thrown at oap-server/mqe-rt/src/main/java/org/apache/skywalking/mqe/rt/operation/BoolOp.java:30
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
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 caseView on GitHub (pinned to 102af09b4a)
Solutions
- Wrap the left operand in an explicit comparison: metric > 0, metric >= threshold
- Make every leaf of a && / || chain a compare expression ('a > b && c < d')
- Check for accidental operator omission when concatenating conditions in generated dashboards
Example fix
# before service_sla && service_resp_time > 500 # after service_sla > 0 && service_resp_time > 500
Defensive patterns
Strategy: validation
Validate before calling
// every leaf of && / || must be a compare result
boolean isBoolLeaf(ExpressionResult r) { return r.isBoolResult(); } Type guard
boolean isCompareResult(org.apache.skywalking.oap.server.core.query.mqe.ExpressionResult r) {
return r.isBoolResult();
} Prevention
- Write boolean chains as 'X <op> Y && X2 <op> Y2' — every leaf compared
- Never use a raw metric as a boolean operand
- Preview boolean expressions in the UI before saving
When it happens
Trigger: An MQE expression like 'service_sla > 1000 && service_resp_time > 500' is fine, but 'service_sla && service_resp_time > 500' (left side never compared) triggers it: the left sub-result was not produced by CompareOp so it carries no boolean semantics.
Common situations: Forgetting the comparison on one side of a logical expression; using a boolean-typed metric name directly expecting truthiness; copying SQL/PromQL boolean-idioms into MQE where only explicit comparisons yield booleans.
Related errors
- Bool Operation: The result of the right expression is not a
- Unsupported bool operation: {}
- Unsupported compare operation: {}
- Unsupported predicted value type: {}
- line {}:{} {}
AI-assisted analysis of apache/skywalking@102af09b4a (2026-08-14).
Data as JSON: /api/errors/5d6577b1dcf9223e.
Report an issue: GitHub.