{"record":{"id":"04d62ec2bebff7d7","repo":"flowable/flowable-engine","slug":"dmn-decision-with-key-externalref-execution-fai","errorCode":null,"errorMessage":"DMN decision with key ${externalRef} execution failed. For ${planItemInstanceEntity}","messagePattern":"DMN decision with key (.+?) execution failed\\. For (.+?)","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/DecisionTaskActivityBehavior.java","lineNumber":118,"sourceCode":"        if (sameDeploymentValue != null) {\r\n            if (Boolean.parseBoolean(sameDeploymentValue)) {\r\n                executeDecisionBuilder.parentDeploymentId(\r\n                        CaseDefinitionUtil.getDefinitionDeploymentId(planItemInstanceEntity.getCaseDefinitionId(), cmmnEngineConfiguration));\r\n            }\r\n        } else {\r\n            // backwards compatibility (always apply parent deployment id)\r\n            executeDecisionBuilder\r\n                    .parentDeploymentId(CaseDefinitionUtil.getDefinitionDeploymentId(planItemInstanceEntity.getCaseDefinitionId(), cmmnEngineConfiguration));\r\n        }\r\n\r\n        DecisionExecutionAuditContainer decisionExecutionAuditContainer = executeDecisionBuilder.executeWithAuditTrail();\r\n\r\n        if (decisionExecutionAuditContainer == null) {\r\n            throw new FlowableException(\"DMN decision with key \" + externalRef + \" was not executed. For \" + planItemInstanceEntity);\r\n        }\r\n        \r\n        if (decisionExecutionAuditContainer.isFailed()) {\r\n            throw new FlowableException(\"DMN decision with key \" + externalRef + \" execution failed. For \" + planItemInstanceEntity,\r\n                    decisionExecutionAuditContainer.getException());\r\n        }\r\n\r\n        /* Throw error if there were no rules hit when the flag indicates to do this. */\r\n        String throwErrorFieldValue = getFieldString(EXPRESSION_DECISION_TABLE_THROW_ERROR_FLAG);\r\n        if (decisionExecutionAuditContainer.getDecisionResult().isEmpty() && throwErrorFieldValue != null) {\r\n            if (\"true\".equalsIgnoreCase(throwErrorFieldValue)) {\r\n                throw new FlowableException(\"DMN decision with key \" + externalRef + \" did not hit any rules for the provided input. For \" + planItemInstanceEntity);\r\n            \r\n            } else if (!\"false\".equalsIgnoreCase(throwErrorFieldValue)) {\r\n                Expression expression = CommandContextUtil.getExpressionManager(commandContext).createExpression(throwErrorFieldValue);\r\n                Object expressionValue = expression.getValue(planItemInstanceEntity);\r\n                \r\n                if (expressionValue instanceof Boolean && ((Boolean) expressionValue)) {\r\n                    throw new FlowableException(\"DMN decision with key \" + externalRef + \" did not hit any rules for the provided input. For \" + planItemInstanceEntity);\r\n                }\r\n            }\r\n        }\r","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/behavior/impl/DecisionTaskActivityBehavior.java#L100-L136","documentation":"The DMN decision executed but its audit container reports isFailed(), meaning rule evaluation raised an exception. The engine rethrows this as a FlowableException with the underlying DMN exception attached as cause. Inspect the cause to see the actual rule-engine failure.","triggerScenarios":"executeWithAuditTrail() returns a DecisionExecutionAuditContainer with isFailed() == true — typically an EL/JUEL error in a rule expression, a missing input variable, or a script/expression exception inside the decision table.","commonSituations":"Input data objects not mapped to the decision's input parameters; rule expressions referencing undefined variables; incompatible types passed into rule conditions (e.g. string vs number); DMN expression language errors after model edits.","solutions":["Inspect the exception cause (decisionExecutionAuditContainer.getException()) for the root DMN error.","Verify all decision input variables are present in the case scope with correct types before the decision task activates.","Test the DMN decision standalone via dmnRuleService.createExecuteDecisionBuilder() with the same inputs to reproduce and debug.","Fix the failing rule expression in the .dmn model and redeploy; ensure expression variable names match the input parameter names."],"exampleFix":"// before: input variable missing -> rule expression fails\ncaseRuntimeService.startCaseInstanceWithVariables(Map.of(\"amount\", 100)); // decision expects \"orderAmount\"\n// after\ncaseRuntimeService.startCaseInstanceWithVariables(Map.of(\"orderAmount\", 100));","handlingStrategy":"try-catch","validationCode":"for (String input : decision.getInputParameters()) {\n    if (!caseVariables.containsKey(input)) {\n        throw new IllegalArgumentException(\"Missing DMN input variable: \" + input);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    caseRuntimeService.triggerPlanItemInstance(planItemId);\n} catch (FlowableException e) {\n    if (e.getMessage().contains(\"execution failed\") && e.getCause() != null) {\n        log.error(\"DMN rule failure root cause\", e.getCause());\n    }\n    throw e;\n}","preventionTips":["Always log/inspect the exception cause — the DMN error detail is in getCause()","Unit-test decision tables standalone with representative inputs","Keep input variable names and types aligned between case and DMN models"],"tags":["cmmn","dmn","expression","rule-engine"],"backgroundTag":"invalid-expression","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}