flowable/flowable-engine · error · FlowableException

Parent activity for boundary compensation event could not be

Error message

Parent activity for boundary compensation event could not be found for ${executionEntity}

What it means

Flowable throws this when the BPMN model contains a compensation boundary event but no source activity attached to it can be found. execute() scans the process associations (findAssociationsWithSourceRefRecursive) for an association originating from the boundary event and identifies the parent activity; if sourceActivity stays null, the model is malformed — the boundary event has no association link to the activity it compensates.

Source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/BoundaryCompensateEventActivityBehavior.java:74

            throw new FlowableException("Process model for " + executionEntity + " could not be found");
        }

        Activity sourceActivity = null;
        Activity compensationActivity = null;
        List<Association> associations = process.findAssociationsWithSourceRefRecursive(boundaryEvent.getId());
        for (Association association : associations) {
            sourceActivity = boundaryEvent.getAttachedToRef();
            FlowElement targetElement = process.getFlowElement(association.getTargetRef(), true);
            if (targetElement instanceof Activity activity) {
                if (activity.isForCompensation()) {
                    compensationActivity = activity;
                    break;
                }
            }
        }
        
        if (sourceActivity == null) {
            throw new FlowableException("Parent activity for boundary compensation event could not be found for " + executionEntity);
        }

        if (compensationActivity == null) {
            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();
            }

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Open the BPMN XML and add an <bpmn:association> whose sourceRef is the activity being compensated and targetRef is the boundary event (or check it isn't pointing at a wrong/renamed id).
  2. Redeploy the process definition after fixing the XML.
  3. Validate the model with a BPMN validator or the Flowable modeler before deploying.
  4. If the association exists, confirm the sourceRef id matches the actual activity id in the same process/subProcess scope.

Example fix

// before (boundary event with no association)
<bpmn:boundaryEvent id="compBoundary" attachedToRef="task1">
  <bpmn:compensateEventDefinition/>
</bpmn:boundaryEvent>

// after (association added)
<bpmn:boundaryEvent id="compBoundary" attachedToRef="task1">
  <bpmn:compensateEventDefinition/>
</bpmn:boundaryEvent>
<bpmn:association id="assoc1" sourceRef="task1" targetRef="compBoundary"/>
Defensive patterns

Strategy: validation

Validate before calling

boolean hasCompensationAssociation(BpmnModel model, String boundaryEventId) {
    Process process = model.getMainProcess();
    return !process.findAssociationsWithSourceRefRecursive(boundaryEventId).isEmpty();
}

Try / catch

try {
    runtimeService.startProcessInstanceByKey("myProcess");
} catch (FlowableException e) {
    if (e.getMessage().contains("Parent activity for boundary compensation event")) {
        // model defect: fix association in BPMN XML and redeploy
    }
}

Prevention

When it happens

Trigger: Deploying/running a BPMN XML where a boundaryEvent with a compensateEventDefinition has no <bpmn:association> (associationDirection/association element in the BPMNDiagram/definitions) linking it to a source activity, or the association's sourceRef points to a non-existent activity id.

Common situations: Hand-edited BPMN XML missing the association element; modelers that don't render compensation associations; renaming an activity id without updating the association sourceRef; copying a boundary event from another diagram without its association.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/5e6657652f487a6d. Report an issue: GitHub.