flowable/flowable-engine · error · FlowableException
Execution could not be found with id
Error message
Execution could not be found with id ${executionId} What it means
AbstractDynamicStateManager.resolveActiveExecution loads an ExecutionEntity by id via executionEntityManager.findById(executionId); when no execution is found it throws FlowableException('Execution could not be found with id ...'). The dynamic state change (process instance migration / change activity state) targets an execution that does not exist in the runtime tables. resolveActiveExecution is called by execution(...).
Solutions
- Verify the executionId exists at call time: runtimeService.createExecutionQuery().executionId(id).singleResult() != null.
- Re-fetch the current execution ids for the process instance instead of using a cached/stale id.
- Confirm you are connected to the same database/tenant where the process instance is running.
- Handle the process instance having already ended — check historicProcessInstance endTime before mutating.
Example fix
// before
changeActivityStateBuilder.moveExecutionToActivityId(staleExecutionId, "task2");
// after
Execution execution = runtimeService.createExecutionQuery().executionId(staleExecutionId).singleResult();
if (execution != null) {
changeActivityStateBuilder.moveExecutionToActivityId(staleExecutionId, "task2");
} Defensive patterns
Strategy: validation
Validate before calling
Execution execution = runtimeService.createExecutionQuery()
.executionId(executionId).singleResult();
if (execution == null) {
throw new IllegalStateException("Execution " + executionId + " no longer active");
} Try / catch
try {
changeActivityStateBuilder.execute();
} catch (FlowableException e) {
if (e.getMessage().startsWith("Execution could not be found with id")) {
// refresh execution ids or handle completed process instance
} else {
throw e;
}
} Prevention
- Re-query execution ids right before dynamic state changes instead of reusing cached ids.
- Check that the process instance has not ended before changing its activity state.
- Ensure all engine instances point at the same database so ids resolve.
When it happens
Trigger: Calling runtimeService.createChangeActivityStateBuilder()... / process instance migration operations with an executionId that does not resolve (AbstractDynamicStateManager.java:294) — wrong id, execution already ended, or different database/tenant.
Common situations: Stale executionId captured before the process instance completed; ids passed from another process engine/datasource; concurrent termination deleting the execution before the dynamic state change runs; typo or truncated 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
- A process instance id is required, but the provided id
- Cannot associate execution by id: no execution with id '
- Cannot find bpmn model for process definition id
- Cannot find execution with id
- Cannot find plan item with definition id
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/185f551110bf5e16.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/dynamic/AbstractDynamicStateManager.java:294
public List<EnableActivityContainer> resolveEnableActivityContainers(ChangeActivityStateBuilderImpl changeActivityStateBuilder) {
List<EnableActivityContainer> enableActivityContainerList = new ArrayList<>();
if (!changeActivityStateBuilder.getEnableActivityIdList().isEmpty()) {
for (EnableActivityIdContainer enableActivityIdContainer : changeActivityStateBuilder.getEnableActivityIdList()) {
EnableActivityContainer enableActivityContainer = new EnableActivityContainer(enableActivityIdContainer.getActivityIds());
enableActivityContainerList.add(enableActivityContainer);
}
}
return enableActivityContainerList;
}
protected ExecutionEntity resolveActiveExecution(String executionId, CommandContext commandContext) {
ExecutionEntityManager executionEntityManager = CommandContextUtil.getExecutionEntityManager(commandContext);
ExecutionEntity execution = executionEntityManager.findById(executionId);
if (execution == null) {
throw new FlowableException("Execution could not be found with id " + executionId);
}
if (Flowable5Util.isFlowable5ProcessDefinitionId(commandContext, execution.getProcessDefinitionId())) {
throw new FlowableException("Flowable 5 process definitions are not supported");
}
return execution;
}
protected List<ExecutionEntity> resolveActiveExecutions(String processInstanceId, String activityId, CommandContext commandContext) {
ExecutionEntityManager executionEntityManager = CommandContextUtil.getExecutionEntityManager(commandContext);
ExecutionEntity processExecution = executionEntityManager.findById(processInstanceId);
if (processExecution == null) {
throw new FlowableException("Execution could not be found with id " + processInstanceId);
}
if (!processExecution.isProcessInstanceType()) {View on GitHub (pinned to d6d39ce1c6)