{"record":{"id":"a6821a84c6941fe9","repo":"flowable/flowable-engine","slug":"condition-expression-returns-non-boolean-result","errorCode":null,"errorMessage":"condition expression returns non-Boolean: <result> (<class name>)","messagePattern":"condition expression returns non-Boolean: <result> \\(<class name>\\)","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/el/RuleExpressionCondition.java","lineNumber":48,"sourceCode":"    protected Expression expression;\n\n    public RuleExpressionCondition(Expression expression) {\n        this.expression = expression;\n    }\n\n    public boolean evaluate(Map<String, Object> variables, ELExecutionContext executionContext) {\n        VariableContainerWrapper variableContainer = new VariableContainerWrapper(variables);\n        variableContainer.setInstanceId(executionContext.getInstanceId());\n        variableContainer.setScopeType(executionContext.getScopeType());\n        variableContainer.setTenantId(executionContext.getTenantId());\n\n        Object result = expression.getValue(variableContainer);\n\n        if (result == null) {\n            throw new FlowableException(\"condition expression returns null\");\n        }\n        if (!(result instanceof Boolean)) {\n            throw new FlowableException(\"condition expression returns non-Boolean: \" + result + \" (\" + result.getClass().getName() + \")\");\n        }\n        return (Boolean) result;\n    }\n\n}\n","sourceCodeStart":30,"sourceCodeEnd":54,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/el/RuleExpressionCondition.java#L30-L54","documentation":"RuleExpressionCondition.evaluate requires the input condition expression to produce a Boolean so the rule engine can compare it against the input entry. If the JUEL expression returns any non-Boolean value (String, Integer, etc.), Flowable throws this exception including the value and its class name. The decision table author must make the condition expression a comparison/logical expression.","triggerScenarios":"executeInputExpression calls evaluate and the expression returns e.g. a String ('yes'), an Integer, or a bare variable reference like ${customerLevel} instead of a comparison like ${customerLevel == 'gold'}.","commonSituations":"Decision table input expression written as a bare variable or literal rather than a boolean comparison; EL function returning a non-Boolean; spreadsheet/DMN export producing expressions of the wrong shape.","solutions":["Rewrite the input expression as a Boolean comparison, e.g. ${amount > 100} instead of ${amount}.","Check that any custom EL function used in the condition returns Boolean, not String/Number.","If the expression evaluates a String, wrap it in a comparison or a Boolean-returning helper function.","Validate the exported DMN XML: inputExpression expressionLanguage JUEL entries should end in boolean predicates.","Log result.getClass() at the call site to identify which expression returns the wrong type (the message already embeds value + class name)."],"exampleFix":"// before (DMN input expression)\n${customerLevel}            // returns String \"gold\"\n// after\n${customerLevel == 'gold'}  // returns Boolean","handlingStrategy":"type-guard","validationCode":"Object v = evaluateRaw(expr); if (!(v instanceof Boolean)) throw new IllegalStateException(\"condition not boolean: \" + v.getClass());","typeGuard":"boolean conditionYieldsBoolean(Object result) {\n    return result != null && result instanceof Boolean;\n}","tryCatchPattern":"try {\n    Boolean hit = condition.evaluate(container);\n} catch (FlowableException e) {\n    if (e.getMessage().startsWith(\"condition expression returns non-Boolean\")) {\n        log.error(\"Fix DMN input expression: {}\", e.getMessage());\n    }\n}","preventionTips":["Author input expressions as comparisons (x == 'gold'), never bare variables.","Ensure custom EL functions return Boolean.","Review DMN XML exports for non-predicate expressions.","Test each decision table rule with representative variables.","Log the embedded value/class from the message to locate the offending expression."],"tags":["dmn","expression-evaluation","type-mismatch"],"backgroundTag":"type-mismatch","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}