{"record":{"id":"5c23555f17df9673","repo":"flowable/flowable-engine","slug":"could-not-execute-inner-activity-behavior-of-multi","errorCode":null,"errorMessage":"Could not execute inner activity behavior of multi instance behavior for ${execution}","messagePattern":"Could not execute inner activity behavior of multi instance behavior for (.+?)","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/SequentialMultiInstanceBehavior.java","lineNumber":131,"sourceCode":"                executionToContinue.setScope(true);\n                executeOriginalBehavior(executionToContinue, multiInstanceRootExecution, loopCounter);\n            } else {\n                CommandContextUtil.getActivityInstanceEntityManager().recordActivityEnd((ExecutionEntity) execution, null);\n                // Delete all local variables\n                Set<String> localVariableInstances = execution.getVariableInstancesLocal().keySet();\n                localVariableInstances.remove(NUMBER_OF_INSTANCES);\n                localVariableInstances.remove(NUMBER_OF_COMPLETED_INSTANCES);\n                localVariableInstances.remove(NUMBER_OF_ACTIVE_INSTANCES);\n                execution.removeVariablesLocal(localVariableInstances);\n                executeOriginalBehavior(execution, multiInstanceRootExecution, loopCounter);\n            }\n\n        } catch (BusinessError error) {\n            // re-throw business fault so that it can be caught by an Error\n            // Intermediate Event or Error Event Sub-Process in the process\n            throw error;\n        } catch (Exception e) {\n            throw new FlowableException(\"Could not execute inner activity behavior of multi instance behavior for \" + execution, e);\n        }\n    }\n}\n","sourceCodeStart":113,"sourceCodeEnd":135,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/SequentialMultiInstanceBehavior.java#L113-L135","documentation":"SequentialMultiInstanceBehavior.continueSequentialMultiInstance wraps any exception raised while executing the inner activity behavior of a sequential multi-instance loop into a FlowableException with cause e (re-throwing BusinessError untouched). This is a wrapper: the real problem is in the inner activity, retrievable via getCause().","triggerScenarios":"Any RuntimeException thrown by the inner behavior during a sequential multi-instance loop iteration — e.g. the inner service task's delegate throws, a sub-process fails — while continueSequentialMultiInstance advances the loop.","commonSituations":"Java delegates or expressions failing for specific loop iterations (bad data in one collection element), class-loading errors for the inner delegate, or database errors during iteration — surfacing as this generic wrapper in logs.","solutions":["Inspect the cause chain (e.getCause()) in logs to find the real failing activity and error","Fix the inner activity's delegate/expression for the failing iteration's data","Add loop-item validation before the multi-instance activity to avoid bad data reaching the inner task","If a business fault is intended, model it as a BPMN error event (BusinessError is re-thrown and can be caught by an error boundary event)"],"exampleFix":"// before\ntry {\n  executeInner(execution);\n} catch (Exception e) {\n  log.error(\"multi-instance failed\", e); // only sees wrapper\n}\n// after\ntry {\n  executeInner(execution);\n} catch (FlowableException e) {\n  Throwable cause = e.getCause();\n  log.error(\"inner activity failed: {}\", cause == null ? e : cause);\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    processEngine.getRuntimeService().signal(executionId);\n} catch (FlowableException e) {\n    Throwable cause = e.getCause();\n    // log/inspect cause — the real inner-activity failure is there\n    if (cause instanceof BpmnError) {\n        // route to error boundary event handling\n    }\n}","preventionTips":["Always inspect getCause() on this wrapper exception","Validate loop collection items before entering the multi-instance activity","Model expected business faults as BPMN errors so they are re-thrown as BusinessError"],"tags":["multi-instance","wrapper-exception","stack-trace","flowable"],"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"}