flowable/flowable-engine · error · FlowableException

Null execution passed

Error message

Null execution passed

What it means

DelegateHelper.getBpmnModel(DelegateExecution) requires a non-null execution because it derives the BPMN model from execution.getProcessDefinitionId(). A null argument is rejected immediately with 'Null execution passed'.

Source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/delegate/DelegateHelper.java:70

    /**
     * To be used in an {@link ActivityBehavior} or {@link JavaDelegate}: leaves the current activity via one specific sequenceflow.
     */
    public static void leaveDelegate(DelegateExecution delegateExecution, String sequenceFlowId) {
        String processDefinitionId = delegateExecution.getProcessDefinitionId();
        org.flowable.bpmn.model.Process process = ProcessDefinitionUtil.getProcess(processDefinitionId);
        FlowElement flowElement = process.getFlowElement(sequenceFlowId);
        if (flowElement instanceof SequenceFlow) {
            delegateExecution.setCurrentFlowElement(flowElement);
            CommandContextUtil.getAgenda().planTakeOutgoingSequenceFlowsOperation((ExecutionEntity) delegateExecution, false);
        } else {
            throw new FlowableException(sequenceFlowId + " does not match a sequence flow for " + delegateExecution);
        }
    }

    /**
     * Returns the {@link BpmnModel} matching the process definition bpmn model for the process definition of the passed {@link DelegateExecution}.
     */
    public static BpmnModel getBpmnModel(DelegateExecution execution) {
        if (execution == null) {
            throw new FlowableException("Null execution passed");
        }
        return ProcessDefinitionUtil.getBpmnModel(execution.getProcessDefinitionId());
    }

    /**
     * Returns the current {@link FlowElement} where the {@link DelegateExecution} is currently at.
     */
    public static FlowElement getFlowElement(DelegateExecution execution) {
        BpmnModel bpmnModel = getBpmnModel(execution);
        FlowElement flowElement = bpmnModel.getFlowElement(execution.getCurrentActivityId());
        if (flowElement == null) {
            throw new FlowableException("Could not find a FlowElement for activityId " + execution.getCurrentActivityId() + " in " + execution);
        }
        return flowElement;
    }

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Ensure the DelegateExecution passed in is the one provided by the engine to your JavaDelegate/Listener
  2. Guard with a null check and provide a meaningful error or fallback before calling the helper
  3. In tests, mock DelegateExecution including a valid processDefinitionId

Example fix

// before
BpmnModel model = DelegateHelper.getBpmnModel(null);

// after
if (execution == null) {
    throw new IllegalStateException("execution required to resolve bpmn model");
}
BpmnModel model = DelegateHelper.getBpmnModel(execution);
Defensive patterns

Strategy: type-guard

Validate before calling

Objects.requireNonNull(execution, "DelegateExecution must not be null before calling DelegateHelper");

Type guard

boolean hasBpmnModelContext(DelegateExecution e) {
    return e != null && e.getProcessDefinitionId() != null;
}

Try / catch

try {
    BpmnModel m = DelegateHelper.getBpmnModel(execution);
} catch (FlowableException e) {
    if ("Null execution passed".equals(e.getMessage())) {
        // supply the engine-provided execution
    } else throw e;
}

Prevention

When it happens

Trigger: Passing null to DelegateHelper.getBpmnModel(...) — e.g. a listener framework that supplies no execution, or a helper method whose execution argument wasn't initialized before the call.

Common situations: Custom delegate/listener code paths that construct DelegateExecution lazily; calling static helper methods in unit tests without a real execution; refactoring that dropped the execution parameter wiring.

Related errors


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