flowable/flowable-engine · error · FlowableObjectNotFoundException
No process instance found for id =
Error message
No process instance found for id = '${processInstanceId}'. What it means
execute() looks up the process instance by id via the ExecutionEntityManager. If no execution exists for the given id, it throws FlowableObjectNotFoundException typed to ProcessInstance, meaning the id does not reference any execution in the runtime database.
Solutions
- Confirm the instance exists in ACT_RU_EXECUTION (runtime, not history) with the given id
- Use the root process instance id from RuntimeService.createProcessInstanceQuery().processInstanceId(...) instead of a stored/copied value
- Check the engine is connected to the correct database/schema where the instance lives
Example fix
// before
managementService.executeCommand(new SetProcessDefinitionVersionCmd("123", 3)); // id may not exist
// after
ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId("123").singleResult();
if (pi != null) {
managementService.executeCommand(new SetProcessDefinitionVersionCmd(pi.getId(), 3));
} Defensive patterns
Strategy: try-catch
Validate before calling
ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(id).singleResult(); boolean exists = pi != null;
Try / catch
try { cmd.execute(ctx); } catch (FlowableObjectNotFoundException e) { // fall back: check history
historyService.createHistoricProcessInstanceQuery().processInstanceId(id).singleResult(); } Prevention
- Query runtime service to confirm existence before migrating
- Distinguish runtime vs historic instances
- Ensure correct datasource/schema
When it happens
Trigger: Calling SetProcessDefinitionVersionCmd (or setProcessDefinitionVersion on the runtime service) with a processInstanceId that was deleted, already ended, never existed, or belongs to a different database/schema.
Common situations: Migrating instances after cleanup jobs removed completed instances; pointing at a historic instance (removed from ACT_RU_EXECUTION); typos in ids; wrong tenant/schema connection.
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
- Cannot find process instance with id
- Cannot find process instance with id
- No process instance found for id =
- No process instance found for id =
- No process instance found for id =
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/dac93d98319c2824.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SetProcessDefinitionVersionCmd.java:84
}
if (processDefinitionVersion == null) {
throw new FlowableIllegalArgumentException("The process definition version is mandatory, but 'null' has been provided.");
}
if (processDefinitionVersion < 1) {
throw new FlowableIllegalArgumentException("The process definition version must be positive, but '" + processDefinitionVersion + "' has been provided.");
}
this.processInstanceId = processInstanceId;
this.processDefinitionVersion = processDefinitionVersion;
}
@Override
public Void execute(CommandContext commandContext) {
// check that the new process definition is just another version of the same
// process definition that the process instance is using
ExecutionEntityManager executionManager = CommandContextUtil.getExecutionEntityManager(commandContext);
ExecutionEntity processInstance = executionManager.findById(processInstanceId);
if (processInstance == null) {
throw new FlowableObjectNotFoundException("No process instance found for id = '" + processInstanceId + "'.", ProcessInstance.class);
} else if (!processInstance.isProcessInstanceType()) {
throw new FlowableIllegalArgumentException("A process instance id is required, but the provided id " + "'" + processInstanceId + "' " + "points to a child execution of process instance " + "'"
+ processInstance.getProcessInstanceId() + "'. " + "Please invoke the " + getClass().getSimpleName() + " with a root execution id.");
}
DeploymentManager deploymentCache = CommandContextUtil.getProcessEngineConfiguration(commandContext).getDeploymentManager();
ProcessDefinition currentProcessDefinition = deploymentCache.findDeployedProcessDefinitionById(processInstance.getProcessDefinitionId());
ProcessDefinition newProcessDefinition = deploymentCache
.findDeployedProcessDefinitionByKeyAndVersionAndTenantId(currentProcessDefinition.getKey(), processDefinitionVersion, currentProcessDefinition.getTenantId());
if (Flowable5Util.isFlowable5ProcessDefinition(currentProcessDefinition, commandContext) && !Flowable5Util
.isFlowable5ProcessDefinition(newProcessDefinition, commandContext)) {
throw new FlowableIllegalArgumentException("The current process definition (id = '" + currentProcessDefinition.getId() + "') is a v5 definition."
+ " However the new process definition (id = '" + newProcessDefinition.getId() + "') is not a v5 definition.");
}
validateAndSwitchVersionOfExecution(commandContext, processInstance, newProcessDefinition);View on GitHub (pinned to d6d39ce1c6)