flowable/flowable-engine · error · FlowableObjectNotFoundException

No process instance found for id =

Error message

No process instance found for id = '${processInstanceId}'.

What it means

Thrown as FlowableObjectNotFoundException when UpdateProcessInstanceCmd cannot find an execution with the given id. The lookup is a plain findById on the execution table, so any id that is not a live execution row (wrong id, deleted instance, different engine/database) results in this error. The ProcessInstance.class reference tells callers what entity was not found.

Solutions

  1. Verify the id exists before updating: runtimeService.createProcessInstanceQuery().processInstanceId(id).singleResult() != null.
  2. Check you are connected to the same database/schema the instance was created in (JDBC url, catalog, tenant config).
  3. Re-fetch the id instead of reusing a stored value; if the instance finished, handle the finished case instead of updating.
  4. Enable Flowable debug logging on the ExecutionEntityManager to see the executed lookup query and confirm the missing row.

Example fix

// before
runtimeService.setProcessInstanceName(processInstanceId, name); // throws if id unknown
// after
ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
if (pi != null) {
    runtimeService.setProcessInstanceName(processInstanceId, name);
}
Defensive patterns

Strategy: validation

Validate before calling

if (runtimeService.createProcessInstanceQuery().processInstanceId(id).singleResult() == null) { throw new IllegalArgumentException("Unknown process instance: " + id); }

Type guard

boolean processInstanceExists(RuntimeService rs, String id) { return id != null && !id.isEmpty() && rs.createProcessInstanceQuery().processInstanceId(id).singleResult() != null; }

Try / catch

try { runtimeService.setProcessInstanceName(id, name); } catch (FlowableObjectNotFoundException e) { LOG.warn("process instance gone: {}", id); }

Prevention

When it happens

Trigger: Calling RuntimeService.updateProcessInstance... (e.g. setProcessInstanceName/updateBusinessKey via UpdateProcessInstanceRequest/builders) with a processInstanceId that does not exist in ACT_RU_EXECUTION, or after the instance was ended/deleted, or pointing at another database/schema.

Common situations: Stale ids cached in application state after instance completion; typo'd or externally supplied ids; pointing the engine at a different database than where the instance was created; cleanup jobs deleting history/runtime rows while app still holds the id.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/af01bcaf8d62795c. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/UpdateProcessInstanceCmd.java:53

    private static final long serialVersionUID = 1L;

    protected ProcessInstanceUpdateBuilderImpl builder;

    public UpdateProcessInstanceCmd(ProcessInstanceUpdateBuilderImpl builder) {
        this.builder = builder;
    }

    @Override
    public Void execute(CommandContext commandContext) {
        String processInstanceId = builder.getProcessInstanceId();
        if (processInstanceId == null || processInstanceId.isEmpty()) {
            throw new FlowableIllegalArgumentException("The process instance id is mandatory, but '" + processInstanceId + "' has been provided.");
        }

        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() + "'.");
        }

        if (builder.isBusinessKeySet()) {
            executionManager.updateProcessInstanceBusinessKey(processInstance, builder.getBusinessKey());
        }

        if (builder.isBusinessStatusSet()) {
            executionManager.updateProcessInstanceBusinessStatus(processInstance, builder.getBusinessStatus());
        }

        if (builder.isNameSet()) {
            processInstance.setName(builder.getName());
            ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);
            processEngineConfiguration.getHistoryManager().recordProcessInstanceNameChange(processInstance, builder.getName());
        }

View on GitHub (pinned to d6d39ce1c6)