flowable/flowable-engine · error · ActivitiObjectNotFoundException
process instance doesn't exist, the given ID references an…
Error message
process instance <processInstanceId> doesn't exist, the given ID references an execution, though
What it means
SetProcessInstanceNameCmd throws ActivitiObjectNotFoundException when the given ID resolves to an execution (a child scope such as a subprocess or concurrent branch) rather than a process instance itself. The engine refuses to treat a plain execution as a process instance, so the name is not set. The message clarifies the ID exists but is the wrong entity type.
Solutions
- Resolve the top-level instance ID via execution.getProcessInstanceId() (or getRootProcessInstanceId()) and pass that instead.
- Pass task.getProcessInstanceId() rather than task.getExecutionId() from listener/task code.
- If you need to mark an inner execution, use process variables — process instance naming only applies to the root instance.
Example fix
// before runtimeService.setProcessInstanceName(task.getExecutionId(), "monthly-run"); // after runtimeService.setProcessInstanceName(task.getProcessInstanceId(), "monthly-run");
Defensive patterns
Strategy: validation
Validate before calling
Execution exec = runtimeService.createExecutionQuery().executionId(id).singleResult(); boolean isProcessInstance = exec != null && exec.getParentId() == null;
Try / catch
try {
runtimeService.setProcessInstanceName(executionId, name);
} catch (ActivitiObjectNotFoundException e) {
logger.warn("ID {} is not a process instance", executionId, e);
} Prevention
- Always pass getProcessInstanceId() from tasks/executions, never getExecutionId().
- Derive instance IDs from ProcessInstanceQuery, not ExecutionQuery.
When it happens
Trigger: Calling RuntimeService.setProcessInstanceName(processInstanceId, name) where processInstanceId is actually the ID of a nested execution or concurrent child, not the top-level process instance.
Common situations: Passing an executionId from a task or listener callback (Task.getExecutionId()) instead of the process instance ID; IDs fetched from intermediate-scope queries.
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
- Cannot find processInstance for id
- Cannot set suspension state for execution
- Could not handle signal: no process instance started
- No process instance found for id
- process instance doesn't exist
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/e929781883524d89.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/SetProcessInstanceNameCmd.java:52
this.name = name;
}
@Override
public Void execute(CommandContext commandContext) {
if (processInstanceId == null) {
throw new ActivitiIllegalArgumentException("processInstanceId is null");
}
ExecutionEntity execution = commandContext
.getExecutionEntityManager()
.findExecutionById(processInstanceId);
if (execution == null) {
throw new ActivitiObjectNotFoundException("process instance " + processInstanceId + " doesn't exist", ProcessInstance.class);
}
if (!execution.isProcessInstanceType()) {
throw new ActivitiObjectNotFoundException("process instance " + processInstanceId +
" doesn't exist, the given ID references an execution, though", ProcessInstance.class);
}
if (execution.isSuspended()) {
throw new ActivitiException("process instance " + processInstanceId + " is suspended, cannot set name");
}
// Actually set the name
execution.setName(name);
// Record the change in history
commandContext.getHistoryManager().recordProcessInstanceNameChange(processInstanceId, name);
return null;
}
}
View on GitHub (pinned to d6d39ce1c6)