flowable/flowable-engine · error · FlowableException
Error while completing sub process of execution + scopeExecu
Error message
Error while completing sub process of execution + scopeExecutionEntity
What it means
When a terminate end event finishes an embedded subprocess scope, Flowable calls SubProcessActivityBehavior.completing. If that call throws a checked Exception it is logged and rethrown wrapped as this FlowableException with the failing scope execution in the message. It indicates the scope-completion callback for the subprocess failed.
Source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/TerminateEndEventActivityBehavior.java:140
} else if (scopeExecutionEntity.getParentId() == null
&& scopeExecutionEntity.getSuperExecutionId() != null) { // CallActivity
ExecutionEntity callActivityExecution = scopeExecutionEntity.getSuperExecution();
CallActivity callActivity = (CallActivity) callActivityExecution.getCurrentFlowElement();
SubProcessActivityBehavior subProcessActivityBehavior = null;
// copy variables before destroying the ended sub process instance (call activity)
subProcessActivityBehavior = (SubProcessActivityBehavior) callActivity.getBehavior();
try {
subProcessActivityBehavior.completing(callActivityExecution, scopeExecutionEntity);
} catch (RuntimeException e) {
LOGGER.error("Error while completing sub process of execution {}", scopeExecutionEntity, e);
throw e;
} catch (Exception e) {
LOGGER.error("Error while completing sub process of execution {}", scopeExecutionEntity, e);
throw new FlowableException("Error while completing sub process of execution " + scopeExecutionEntity, e);
}
if (callActivity.hasMultiInstanceLoopCharacteristics()) {
sendProcessInstanceCompletedEvent(scopeExecutionEntity, execution.getCurrentFlowElement());
MultiInstanceActivityBehavior multiInstanceBehavior = (MultiInstanceActivityBehavior) callActivity.getBehavior();
multiInstanceBehavior.leave(callActivityExecution);
executionEntityManager.deleteProcessInstanceExecutionEntity(scopeExecutionEntity.getId(),
execution.getCurrentFlowElement().getId(), "terminate end event", false, false, false);
} else {
sendProcessInstanceCompletedEvent(scopeExecutionEntity, execution.getCurrentFlowElement());
executionEntityManager.deleteProcessInstanceExecutionEntity(scopeExecutionEntity.getId(),
execution.getCurrentFlowElement().getId(), "terminate end event", false, false, false);
ExecutionEntity superExecutionEntity = executionEntityManager.findById(scopeExecutionEntity.getSuperExecutionId());
CommandContextUtil.getAgenda(commandContext).planTakeOutgoingSequenceFlowsOperation(superExecutionEntity, true);
}
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Look at the LOGGER output directly above this throw for the root cause stack trace
- Check execution-tree consistency in ACT_RU_EXECUTION for the process instance (orphans/duplicates) after any manual DB intervention
- Reproduce with a minimal process (terminate end event in subprocess) and inspect the cause
- Upgrade to the latest Flowable patch release, as execution-tree teardown bugs have been fixed historically
- Avoid terminating inside multi-instance subprocesses until the underlying cause is fixed
Defensive patterns
Strategy: try-catch
Try / catch
try {
runtimeService.trigger(executionId);
} catch (FlowableException e) {
logger.error("Terminate/scope completion failed for execution " + executionId, e);
// inspect root cause before retrying or restoring state
} Prevention
- Never edit ACT_RU_* tables manually
- Keep the engine on the latest patch release
- Test terminate end events inside subprocesses/multi-instance before production
- Avoid terminate end events inside multi-instance subprocesses unless required
When it happens
Trigger: defaultTerminateEndEventBehaviour handling a terminate end event inside a subprocess/callActivity with multi-instance characteristics; the completing() call on the subprocess behavior throws an exception (e.g. persistence, variable handling failure).
Common situations: Terminate end event inside an embedded subprocess whose scope teardown fails due to concurrent modification or data-store errors; multi-instance subprocess termination interacting with broken execution tree state after failed upgrades or manual DB edits.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- No initial activity found for subprocess + subProcess.getId(
- Programmatic error: sub process behaviour can only be applie
- No initial activity found for subprocess %s
- completing() can only be called on a %s instance
- completed() can only be called on a %s instance
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/6cfe56c429bd1579.
Report an issue: GitHub.