{"record":{"id":"4610e57ac7db5f6f","repo":"flowable/flowable-engine","slug":"execution-was-not-a-decision-or-decision-service","errorCode":null,"errorMessage":"Execution was not a decision or decision service","messagePattern":"Execution was not a decision or decision service","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/DmnDecisionServiceImpl.java","lineNumber":204,"sourceCode":"        DecisionServiceExecutionAuditContainer decisionServiceExecutionAuditContainer = (DecisionServiceExecutionAuditContainer) finalizeDecisionExecutionAudit(executeDecisionContext);\n\n        return decisionServiceExecutionAuditContainer;\n    }\n\n\n\n    protected Map<String, List<Map<String, Object>>> composeEvaluateDecisionResult(ExecuteDecisionContext executeDecisionContext) {\n        Map<String, List<Map<String, Object>>> result;\n\n        // check if execution was Decision or DecisionService\n        if (executeDecisionContext.getDmnElement() instanceof DecisionService) {\n            result = composeDecisionServiceResult(executeDecisionContext);\n        } else if (executeDecisionContext.getDmnElement() instanceof Decision) {\n            result = new HashMap<>();\n            result.put(executeDecisionContext.getDecisionKey(), executeDecisionContext.getDecisionExecution().getDecisionResult());\n        } else {\n            LOGGER.error(\"Execution was not a decision or decision service\");\n            throw new FlowableException(\"Execution was not a decision or decision service\");\n        }\n\n        return result;\n    }\n\n    protected List<Map<String, Object>> composeDecisionResult(ExecuteDecisionContext executeDecisionContext) {\n        return executeDecisionContext.getDecisionExecution().getDecisionResult();\n    }\n\n    protected Map<String, List<Map<String, Object>>> composeDecisionServiceResult(ExecuteDecisionContext executeDecisionContext) {\n        // check if execution was Decision or DecisionService\n        if (executeDecisionContext.getDmnElement() instanceof DecisionService decisionService) {\n            Map<String, List<Map<String, Object>>> decisionServiceResult = new HashMap<>();\n            DecisionServiceExecutionAuditContainer decisionServiceExecutionAuditContainer = (DecisionServiceExecutionAuditContainer) executeDecisionContext.getDecisionExecution();\n\n            boolean multipleResults = decisionService.getOutputDecisions().size() > 1;\n            for (DmnElementReference elementReference : decisionService.getOutputDecisions()) {\n                DecisionExecutionAuditContainer childDecisionExecution = decisionServiceExecutionAuditContainer","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/DmnDecisionServiceImpl.java#L186-L222","documentation":"composeEvaluateDecisionResult expects the executed DMN element to be either a Decision or a DecisionService. When the ExecuteDecisionContext holds neither (e.g. no DmnElement was resolved or it is another element type), Flowable logs and throws this FlowableException.","triggerScenarios":"Calling decision evaluation (decisionResult/executeWithAuditTrail paths) with a decision key that does not resolve to a Decision or DecisionService element, or a context whose DmnElement was never set.","commonSituations":"Typo'd or stale decision key after re-deploying a changed model; passing an artifact key from a different engine (e.g. a process or case element); programmatic misuse of internal APIs with a partially-built ExecuteDecisionContext.","solutions":["Verify the decisionKey matches a <decision> or <decisionService> element in the deployed DMN XML","Re-deploy the DMN resource and confirm the deployment contains the expected model","Check that you are using the DMN engine's APIs for DMN artifacts, not process/case keys"],"exampleFix":"// before\ndmnEngineRule.getDmnEngine().getDecisionService().executeDecision(key, vars); // key points at a non-decision element\n// after\nDmnRepositoryService repo = dmnEngine.getDmnRepositoryService();\nif (repo.createDecisionTableQuery().decisionTableKey(key).count() > 0) { /* evaluate */ }","handlingStrategy":"validation","validationCode":"DmnDecision decision = dmnRepositoryService.getDmnModel(deploymentId).getDecisionById(decisionKey);\nif (decision == null) throw new IllegalArgumentException(\"Key \" + decisionKey + \" is not a decision in deployment \" + deploymentId);","typeGuard":null,"tryCatchPattern":"try {\n    Map<String,Object> res = decisionService.decisionResult(ctx);\n} catch (FlowableException e) {\n    if (e.getMessage().contains(\"not a decision or decision service\")) { /* re-check the key/deployment */ }\n    throw e;\n}","preventionTips":["Keep decision keys in constants shared with the DMN model","Validate keys against the deployed model before evaluating","Re-verify keys after re-deploying changed models"],"tags":["dmn","decision-service","invalid-state"],"backgroundTag":"internal-invariant-violation","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"}