flowable/flowable-engine · warning

Invalid reference in boundary event. Make sure that the…

Error message

Invalid reference in boundary event. Make sure that the referenced activity is defined in the same scope as the boundary event {}

What it means

BoundaryEventParseHandler.executeParse() warns and aborts parsing of the boundary event when the activity referenced by attachedToRef cannot be found in the same scope. The boundary event is skipped, so its event handling (timer, error, message, etc.) will not exist at runtime.

Solutions

  1. Ensure attachedToRef points to an activity defined in the same scope as the boundary event
  2. Move the boundary event into the same subprocess/level as its target activity
  3. Fix or restore the referenced activity id
  4. Validate the BPMN before deployment to catch dangling attachedToRef values

Example fix

// before
<boundaryEvent id="be1" attachedToRef="taskInSubprocess"/> (at process level)
// after
<boundaryEvent id="be1" attachedToRef="taskAtSameLevel"/> (inside the same subprocess)
Defensive patterns

Strategy: validation

Validate before calling

// attachedToRef must resolve in the same scope
for (BoundaryEvent be : collectBoundaryEvents(process)) {
    if (findActivityInSameScope(process, be.getAttachedToRefId()) == null)
        throw new IllegalArgumentException("Boundary event " + be.getId()
            + " attachedToRef " + be.getAttachedToRefId() + " not in same scope");
}

Prevention

When it happens

Trigger: A <boundaryEvent attachedToRef="someTask"/> whose referenced activity is missing or defined in a different scope (e.g. inside a subprocess while the boundary event sits at process level); detected via findActivity() returning null.

Common situations: Renamed/deleted task ids not updated in attachedToRef; boundary event placed outside the subprocess containing its target; modeler exports moving elements between scopes.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/parser/handler/BoundaryEventParseHandler.java:45

/**
 * @author Joram Barrez
 */
public class BoundaryEventParseHandler extends AbstractFlowNodeBpmnParseHandler<BoundaryEvent> {

    private static final Logger LOGGER = LoggerFactory.getLogger(BoundaryEventParseHandler.class);

    @Override
    public Class<? extends BaseElement> getHandledType() {
        return BoundaryEvent.class;
    }

    @Override
    protected void executeParse(BpmnParse bpmnParse, BoundaryEvent boundaryEvent) {

        ActivityImpl parentActivity = findActivity(bpmnParse, boundaryEvent.getAttachedToRefId());
        if (parentActivity == null) {
            LOGGER.warn("Invalid reference in boundary event. Make sure that the referenced activity is defined in the same scope as the boundary event {}", boundaryEvent.getId());
            return;
        }

        ActivityImpl nestedActivity = createActivityOnScope(bpmnParse, boundaryEvent, BpmnXMLConstants.ELEMENT_EVENT_BOUNDARY, parentActivity);
        bpmnParse.setCurrentActivity(nestedActivity);

        EventDefinition eventDefinition = null;
        if (!boundaryEvent.getEventDefinitions().isEmpty()) {
            eventDefinition = boundaryEvent.getEventDefinitions().get(0);
        }

        if (eventDefinition instanceof TimerEventDefinition
                || eventDefinition instanceof org.flowable.bpmn.model.ErrorEventDefinition
                || eventDefinition instanceof SignalEventDefinition
                || eventDefinition instanceof CancelEventDefinition
                || eventDefinition instanceof MessageEventDefinition
                || eventDefinition instanceof org.flowable.bpmn.model.CompensateEventDefinition) {

View on GitHub (pinned to d6d39ce1c6)