flowable/flowable-engine · critical · FlowableException
Could not find a scope execution for compensation boundary e
Error message
Could not find a scope execution for compensation boundary event ${boundaryEvent.getId()} for ${executionEntity} What it means
Flowable throws this when execute() cannot find the scope execution (the enclosing subprocess or process instance execution) under which to register the CompensateEventSubscription. The algorithm walks up the parent-execution chain looking for a scope execution; if the chain is exhausted (parentExecution == null) without finding one, the execution tree is inconsistent with the model. This indicates a corrupted runtime execution hierarchy rather than a modeling error.
Source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/BoundaryCompensateEventActivityBehavior.java:96
throw new FlowableException("Compensation activity could not be found (or it is missing 'isForCompensation=\"true\"') for " + executionEntity);
}
// find SubProcess or Process instance execution
ExecutionEntity scopeExecution = null;
ExecutionEntity parentExecution = executionEntity.getParent();
while (scopeExecution == null && parentExecution != null) {
if (parentExecution.getCurrentFlowElement() instanceof SubProcess) {
scopeExecution = parentExecution;
} else if (parentExecution.isProcessInstanceType()) {
scopeExecution = parentExecution;
} else {
parentExecution = parentExecution.getParent();
}
}
if (scopeExecution == null) {
throw new FlowableException("Could not find a scope execution for compensation boundary event " + boundaryEvent.getId() + " for " + executionEntity);
}
ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration();
EventSubscriptionEntity eventSubscription = (EventSubscriptionEntity) processEngineConfiguration.getEventSubscriptionServiceConfiguration()
.getEventSubscriptionService().createEventSubscriptionBuilder()
.eventType(CompensateEventSubscriptionEntity.EVENT_TYPE)
.executionId(scopeExecution.getId())
.processInstanceId(scopeExecution.getProcessInstanceId())
.activityId(sourceActivity.getId())
.tenantId(scopeExecution.getTenantId())
.create();
CountingEntityUtil.handleInsertEventSubscriptionEntityCount(eventSubscription);
}
@Override
public void trigger(DelegateExecution execution, String triggerName, Object triggerData) {
ExecutionEntity executionEntity = (ExecutionEntity) execution;View on GitHub (pinned to d6d39ce1c6)
Solutions
- Inspect the execution tree in ACT_RU_EXECUTION for the reported executionEntity; look for a missing or dangling parentExecutionId and fix by terminating/restarting the process instance.
- Cancel and restart the affected process instance to rebuild a consistent execution tree.
- Remove custom code that mutates executions (ExecutionEntityManager.createChildExecution/deleteExecution misuse).
- Check for concurrency issues: serialize operations on the process instance or add optimistic-locking-aware retries.
- If reproducible on a supported flowable version, file an issue with the process model and stack trace.
Defensive patterns
Strategy: try-catch
Try / catch
try {
runtimeService.trigger(executionId);
} catch (FlowableException e) {
if (e.getMessage().startsWith("Could not find a scope execution")) {
// runtime execution tree corrupted: inspect ACT_RU_EXECUTION,
// terminate and restart the process instance
}
} Prevention
- Never manually create, delete, or reparent ExecutionEntity objects from custom code.
- Avoid concurrent operations (terminate + signal) on the same process instance; serialize via optimistic locking retries.
- Back up and verify ACT_RU_EXECUTION integrity after database restores or manual maintenance.
When it happens
Trigger: A boundary compensate event fires on an execution whose parent chain lacks a scope execution — e.g. after custom execution-tree manipulation, concurrent modification of executions, or engine internals (cascade delete, partial rollback) leaving orphaned child executions.
Common situations: Concurrent operations on the same process instance (cancel/terminate racing with event firing); custom JavaDelegate/listener code that creates, deletes, or reparents executions; database state edited manually; engine bugs during multi-instance subprocess compensation.
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
- Execution '<execution>' is not a processInstance
- Process model for ${executionEntity} could not be found
- Parent activity for boundary compensation event could not be
- Compensation activity could not be found (or it is missing '
- Process model (id = ${processDefinitionId}) could not be fou
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/e0f3a8ca63a356dd.
Report an issue: GitHub.