{"record":{"id":"b63ae038e368b716","repo":"flowable/flowable-engine","slug":"condition-expression-returns-null","errorCode":null,"errorMessage":"condition expression returns null","messagePattern":"condition expression returns null","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":45,"sourceCode":" */\npublic class RuleExpressionCondition {\n\n    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":27,"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#L27-L54","documentation":"When evaluating a DMN rule's input condition, Flowable calls the JUEL expression via RuleExpressionCondition.evaluate and requires a Boolean answer (does the rule match or not). If the expression evaluates to null — e.g. it references an undefined variable or compares against a missing value — Flowable cannot decide the rule and throws this exception. A null condition result is never treated as 'false'; it is a hard error.","triggerScenarios":"executeInputExpression calls evaluate and the JUEL expression returns null: a referenced execution variable is absent from the variable container, an EL function returns null, or the expression is a plain null-valued operand.","commonSituations":"Decision table input expression references a process variable that was never set; variable name typo (case-sensitive EL); a custom EL function returns Optional.empty/null; null is passed as the hit input value.","solutions":["Ensure every variable referenced by the decision table's input expressions is set on the execution/variable container before the DMN task runs.","Check the input expression in the decision table for typos or references to variables not in scope (EL is case-sensitive).","Make the expression null-safe, e.g. use `${var != null && var == 'X'}` so the condition always yields a Boolean.","Set a default value for the variable before invoking the DMN rule task.","Wrap the rule execution in try-catch for FlowableException and log which input expression produced the null."],"exampleFix":"// before (DMN input expression)\n${customerLevel == 'gold'}   // customerLevel is null -> error\n// after\n${customerLevel != null && customerLevel == 'gold'}","handlingStrategy":"type-guard","validationCode":"if (!execution.hasVariable(\"customerLevel\")) throw new IllegalStateException(\"DMN input variable customerLevel missing\");","typeGuard":"boolean isBooleanResult(Object result) { return result instanceof Boolean; }","tryCatchPattern":"try {\n    boolean hit = ruleExpression.evaluate(...);\n} catch (FlowableException e) {\n    if (\"condition expression returns null\".equals(e.getMessage())) {\n        log.warn(\"DMN condition null, variable missing?\", e);\n    }\n}","preventionTips":["Set every variable referenced by decision-table input expressions before evaluation.","Write null-safe EL conditions (var != null && ...).","Use case-sensitive variable name checks against the DMN expressions.","Give variables default values at process start.","Keep EL functions returning Boolean only."],"tags":["dmn","expression-evaluation","null-value"],"backgroundTag":"null-argument","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"}