{"record":{"id":"7d22d94e0ccf2132","repo":"flowable/flowable-engine","slug":"more-than-one-result","errorCode":null,"errorMessage":"more than one result","messagePattern":"more than one result","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/DmnDecisionServiceImpl.java","lineNumber":120,"sourceCode":"        }\n\n        return singleDecisionResult;\n    }\n\n    @Override\n    public Map<String, Object> executeDecisionWithSingleResult(ExecuteDecisionBuilder builder) {\n        ExecuteDecisionContext executeDecisionContext = builder.buildExecuteDecisionContext();\n\n        commandExecutor.execute(new ExecuteDecisionCmd(executeDecisionContext));\n\n        Map<String, Object> singleDecisionResult = null;\n        List<Map<String, Object>> decisionResult = composeDecisionResult(executeDecisionContext);\n\n        finalizeDecisionExecutionAudit(executeDecisionContext);\n\n        if (decisionResult != null && !decisionResult.isEmpty()) {\n            if (decisionResult.size() > 1) {\n                throw new FlowableException(\"more than one result\");\n            }\n            singleDecisionResult = decisionResult.get(0);\n        }\n\n        return singleDecisionResult;\n    }\n\n    @Override\n    public Map<String, Object> executeDecisionServiceWithSingleResult(ExecuteDecisionBuilder builder) {\n        ExecuteDecisionContext executeDecisionContext = builder.buildExecuteDecisionContext();\n\n        commandExecutor.execute(new ExecuteDecisionServiceCmd(executeDecisionContext));\n\n        Map<String, Object> singleDecisionResult = new HashMap<>();\n        Map<String, List<Map<String, Object>>> decisionResult = composeDecisionServiceResult(executeDecisionContext);\n\n        finalizeDecisionExecutionAudit(executeDecisionContext);\n","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/DmnDecisionServiceImpl.java#L102-L138","documentation":"DmnDecisionServiceImpl.executeDecisionWithSingleResult runs a DMN decision and converts its result list into a single row. If the composed decision result contains more than one row it throws FlowableException(\"more than one result\"), since a single-result API has no way to represent multiple matching output rows.","triggerScenarios":"Calling executeDecisionWithSingleResult for a decision expression/table that evaluates to multiple results — e.g. a decision table with overlapping rules producing several rows, or a collection-style decision returning multiple items — when the caller expected exactly one.","commonSituations":"Overlapping rule conditions in the DMN table (input ranges like x<10 and x>5); using COLLECT/multi-hit policies with a single-result invocation; business data changes causing previously-unique rules to both fire; forgotten aggregation (sum/count) upstream of the single-result call.","solutions":["Adjust the decision model so exactly one row is produced per execution (exclusive conditions or FIRST hit policy).","Use the multi-result execution API instead and pick/aggregate the row you need.","Aggregate in the decision itself (e.g. return a sum or combined output) so the result is a single row.","Inspect input values with a test deployment to identify which rules overlap for the failing payload."],"exampleFix":"// before\nMap<String, Object> result = dmnService.executeDecisionWithSingleResult(ctx);\n// after\nList<Map<String, Object>> results = dmnService.executeDecision(ctx);\nif (results == null || results.isEmpty()) {\n    throw new IllegalStateException(\"decision returned no result\");\n}\nMap<String, Object> result = results.get(0);","handlingStrategy":"try-catch","validationCode":"// Verify the decision cannot yield multiple rows, or use the multi-result API:\nList<Map<String, Object>> results = dmnService.executeDecision(ctx);\nif (results != null && results.size() > 1) {\n    throw new IllegalStateException(\"expected single decision result, got \" + results.size());\n}","typeGuard":null,"tryCatchPattern":"try {\n    result = dmnService.executeDecisionWithSingleResult(ctx);\n} catch (FlowableException e) {\n    if (\"more than one result\".equals(e.getMessage())) {\n        // retry with the multi-result API and aggregate/pick a row\n    } else { throw e; }\n}","preventionTips":["Give decision tables exclusive rule conditions or a single-hit policy","Aggregate outputs (sum/count/merge) in the decision model when several rules legitimately apply","Test deployed decisions with representative input payloads to catch multi-row results early","Prefer the list-returning API unless a single row is guaranteed"],"tags":["java","flowable","dmn","decision-table","hit-policy","multiple-results"],"backgroundTag":"unexpected-response-shape","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"}