flowable/flowable-engine · error · FlowableObjectNotFoundException
No execution found for id '${executionId}'
Error message
No execution found for id '${executionId}' What it means
ExecuteActivityForAdhocSubProcessCmd looks up the execution by id and throws FlowableObjectNotFoundException when findById returns null, meaning no execution with the given id exists in this engine (or it was already ended/removed).
Source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/ExecuteActivityForAdhocSubProcessCmd.java:47
/**
* @author Tijs Rademakers
*/
public class ExecuteActivityForAdhocSubProcessCmd implements Command<Execution>, Serializable {
private static final long serialVersionUID = 1L;
protected String executionId;
protected String activityId;
public ExecuteActivityForAdhocSubProcessCmd(String executionId, String activityId) {
this.executionId = executionId;
this.activityId = activityId;
}
@Override
public Execution execute(CommandContext commandContext) {
ExecutionEntity execution = CommandContextUtil.getExecutionEntityManager(commandContext).findById(executionId);
if (execution == null) {
throw new FlowableObjectNotFoundException("No execution found for id '" + executionId + "'", ExecutionEntity.class);
}
if (!(execution.getCurrentFlowElement() instanceof AdhocSubProcess adhocSubProcess)) {
throw new FlowableException("The current flow element of the requested " + execution + " is not an ad-hoc sub process");
}
FlowNode foundNode = null;
// if sequential ordering, only one child execution can be active
if (adhocSubProcess.hasSequentialOrdering()) {
if (execution.getExecutions().size() > 0) {
throw new FlowableException("Sequential ad-hoc sub process in " + execution + " already has an active execution");
}
}
for (FlowElement flowElement : adhocSubProcess.getFlowElements()) {
if (activityId.equals(flowElement.getId()) && flowElement instanceof FlowNode flowNode) {
if (flowNode.getIncomingFlows().size() == 0) {View on GitHub (pinned to d6d39ce1c6)
Solutions
- Validate the executionId with runtimeService.createExecutionQuery().executionId(id).singleResult() before invoking
- Confirm the process instance is still running and the id is an execution id, not a task or process instance id from another table
- Check you are connected to the correct database/tenant
Example fix
// before
managementService.executeCommand(new ExecuteActivityForAdhocSubProcessCmd(staleId, "activity1"));
// after
Execution exec = runtimeService.createExecutionQuery().executionId(executionId).singleResult();
if (exec == null) throw new IllegalArgumentException("unknown execution " + executionId);
managementService.executeCommand(new ExecuteActivityForAdhocSubProcessCmd(exec.getId(), "activity1")); Defensive patterns
Strategy: validation
Validate before calling
Execution exec = runtimeService.createExecutionQuery().executionId(executionId).singleResult();
if (exec == null) throw new IllegalArgumentException("unknown executionId: " + executionId); Type guard
boolean executionExists(String id) { return runtimeService.createExecutionQuery().executionId(id).count() > 0; } Try / catch
try { ... } catch (FlowableObjectNotFoundException e) { if (e.getEntityClass() == ExecutionEntity.class) { /* refresh ids / fail gracefully */ } else throw e; } Prevention
- Re-fetch execution ids from a query right before use; never cache them across transactions
- Distinguish execution ids from task/process-instance ids
- Verify tenant/datasource consistency
When it happens
Trigger: Calling dynamicBPMN/ad-hoc-subprocess APIs such as executing an ad-hoc activity with an executionId that has completed, was deleted, belongs to another engine's database, or is simply mistyped.
Common situations: Stale executionId captured before process instance termination; querying the wrong tenant/engine datasource; copy-paste of a task id instead of an execution id.
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
- The current flow element of the requested ${execution} is no
- Sequential ad-hoc sub process in ${execution} already has an
- The requested activity with id ${activityId} can not be enab
- execution ${executionId} doesn't exist
- The current flow element of the requested ${execution} is no
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/f62300ce7174c538.
Report an issue: GitHub.