flowable/flowable-engine · error · FlowableException
Invalid sourceElementId
Error message
Invalid sourceElementId '${sourceElementId}': no element found for this id n process definition '${processDefinitionId}' What it means
ExecutionGraphUtil.isReachable validates that the source element id can be resolved to a FlowNode in the deployed process model before doing a graph traversal. When BpmnModel.getElementById (or equivalent lookup) returns nothing for sourceElementId, Flowable throws this FlowableException because reachability cannot be computed from a nonexistent element.
Solutions
- Verify the sourceElementId exists in the current process definition (inspect the BPMN XML or use BpmnModel.getElementById) and correct the id.
- Make sure you reference the same process definition version — pass the exact processDefinitionId of the deployed definition containing the element.
- Check whether the definition was redeployed and element ids were regenerated; update callers accordingly.
- Null-check the element in caller code against the model before invoking isReachable.
Example fix
// before
boolean ok = executionGraphUtil.isReachable("procDef:1", "wrongTaskId", "endEvent");
// after
BpmnModel model = repositoryService.getBpmnModel(processDefinitionId);
if (model.getFlowElement("startTask") != null) {
boolean ok = executionGraphUtil.isReachable(processDefinitionId, "startTask", "endEvent");
} Defensive patterns
Strategy: validation
Validate before calling
BpmnModel model = repositoryService.getBpmnModel(processDefinitionId);
if (model.getFlowElement(sourceElementId) == null) {
throw new IllegalArgumentException("sourceElementId " + sourceElementId + " not in " + processDefinitionId);
} Prevention
- Resolve element ids from the same process definition version you pass in
- Never hardcode element ids across deployments; read them from the model
- Validate BPMN ids after diagram edits before programmatic use
When it happens
Trigger: Calling the public isReachable(processDefinitionId, sourceElementId, targetElementId) API where sourceElementId does not match any flow element in the process definition resolved from the repository/deployment cache.
Common situations: Typo in the element id; using an id from a different (older/newer) process definition version; passing a sequence-flow id as the source where a flow node is required and the lookup fails; ids from a process definition that was redeployed or deleted.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Invalid targetElementId
- activity ' ' has duplicate transition
- Could not find a FlowElement for activityId
- Could not find cancel boundary event for cancel end event
- Default sequence flow
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/2c809f392a830c26.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/util/ExecutionGraphUtil.java:62
FlowElement sourceFlowElement = process.getFlowElement(sourceElementId, true);
FlowNode sourceElement = null;
if (sourceFlowElement instanceof FlowNode) {
sourceElement = (FlowNode) sourceFlowElement;
} else if (sourceFlowElement instanceof SequenceFlow) {
sourceElement = (FlowNode) ((SequenceFlow) sourceFlowElement).getTargetFlowElement();
}
FlowElement targetFlowElement = process.getFlowElement(targetElementId, true);
FlowNode targetElement = null;
if (targetFlowElement instanceof FlowNode) {
targetElement = (FlowNode) targetFlowElement;
} else if (targetFlowElement instanceof SequenceFlow) {
targetElement = (FlowNode) ((SequenceFlow) targetFlowElement).getTargetFlowElement();
}
if (sourceElement == null) {
throw new FlowableException("Invalid sourceElementId '" + sourceElementId + "': no element found for this id n process definition '" + processDefinitionId + "'");
}
if (targetElement == null) {
throw new FlowableException("Invalid targetElementId '" + targetElementId + "': no element found for this id n process definition '" + processDefinitionId + "'");
}
Set<String> visitedElements = new HashSet<>();
return isReachable(process, sourceElement, targetElement, visitedElements);
}
public static boolean isReachable(Process process, FlowNode sourceElement, FlowNode targetElement, Set<String> visitedElements) {
// Special case: start events in an event subprocess might exist as an execution and are most likely be able to reach the target
// when the target is in the event subprocess, but should be ignored as they are not 'real' runtime executions (but rather waiting for a trigger)
if (sourceElement instanceof StartEvent && isInEventSubprocess(sourceElement)) {
return false;
}
// No outgoing seq flow: could be the end of eg . the process or an embedded subprocessView on GitHub (pinned to d6d39ce1c6)