{"record":{"id":"18f0faa31c7c3ae9","repo":"flowable/flowable-engine","slug":"rule-cannot-be-null","errorCode":null,"errorMessage":"rule cannot be null","messagePattern":"rule cannot be null","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/RuleEngineExecutorImpl.java","lineNumber":166,"sourceCode":"\n            // post rule conclusion actions\n            if (getHitPolicyBehavior(decisionTable.getHitPolicy()) instanceof ComposeDecisionResultBehavior) {\n                getHitPolicyBehavior(decisionTable.getHitPolicy()).composeDecisionResults(executionContext);\n            }\n\n        } catch (FlowableException ade) {\n            LOGGER.error(\"decision table execution failed\", ade);\n            executionContext.getRuleResults().clear();\n            executionContext.getAuditContainer().setFailedWithException(ade);\n            executionContext.getAuditContainer().setExceptionMessage(getExceptionMessage(ade));\n        }\n\n        LOGGER.debug(\"End table evaluation: {}\", decisionTable.getId());\n    }\n\n    protected boolean executeRule(DecisionRule rule, ELExecutionContext executionContext) {\n        if (rule == null) {\n            throw new FlowableException(\"rule cannot be null\");\n        }\n\n        LOGGER.debug(\"Start rule {} evaluation\", rule.getRuleNumber());\n\n        // add audit entry\n        executionContext.getAuditContainer().addRuleEntry(rule);\n\n        boolean conditionResult = false;\n\n        // go through conditions\n        for (RuleInputClauseContainer conditionContainer : rule.getInputEntries()) {\n\n            // resetting value\n            String inputEntryId = conditionContainer.getInputEntry().getId();\n            conditionResult = false;\n\n            try {\n                // if condition is empty condition or has dash symbol result is TRUE","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/RuleEngineExecutorImpl.java#L148-L184","documentation":"executeRule guards against a null DecisionRule while iterating a decision table's rules (RuleEngineExecutorImpl.java:164-167), throwing FlowableException(\"rule cannot be null\"). It protects the per-rule evaluation (audit entry, input-expression evaluation) from dereferencing a null rule. The exception bubbles up to evaluateDecisionTable's FlowableException catch, so the audit container is marked failed with this message rather than crashing the whole execute call.","triggerScenarios":"A DecisionTable whose getRules() list contains a null element — typically from a corrupted/hand-edited .dmn model, a custom model-to-model conversion that inserts null entries, or programmatic table construction adding null rules. Called from executeRule via the rules loop in evaluateDecisionTable (via ruleResult path).","commonSituations":"Generating DMN XML dynamically where a rule template rendered an empty/null entry, custom model transformers or migration code populating the rules list incorrectly, or reflective calls to executeRule(null, ctx).","solutions":["Sanitize the decision table before execution: remove null elements from decisionTable.getRules().","Fix the model source — inspect the deployed .dmn XML or the converter/transformer producing the rules list.","If building tables programmatically, validate each rule is non-null before adding it.","Handle the failure gracefully: catch FlowableException from execute() and check the audit container's isFailed()/exceptionMessage."],"exampleFix":"// before\ntable.getRules().add(null); // later throws \"rule cannot be null\"\n// after\nfor (DecisionRule rule : rules) {\n    if (rule != null) {\n        table.getRules().add(rule);\n    }\n}","handlingStrategy":"validation","validationCode":"List<DecisionRule> rules = ((DecisionTable) decision.getExpression()).getRules();\nif (rules.stream().anyMatch(Objects::isNull)) {\n    throw new IllegalStateException(\"decision table contains null rules; fix the model source\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    audit = ruleEngineExecutor.execute(decision, ctx);\n} catch (FlowableException fe) {\n    if (\"rule cannot be null\".equals(fe.getMessage())) {\n        log.error(\"Corrupt DMN model: null rule in table\", fe);\n    }\n}","preventionTips":["Reject null rules when constructing tables programmatically.","Validate generated .dmn XML against the DMN schema before deployment.","Audit any custom model transformers/migrations that touch the rules list."],"tags":["dmn","java","null-check","model-corruption"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}