flowable/flowable-engine · error · FlowableObjectNotFoundException

process instance doesn't exist

Error message

process instance ${processInstanceId} doesn't exist

What it means

SetProcessInstanceNameCmd looked up the given id with the execution entity manager and found nothing, so it throws ObjectNotFound typed to ProcessInstance. Either the id is wrong, the instance was deleted, or the instance lives in another engine/datasource.

Solutions

  1. Verify the instance still exists via runtimeService.createProcessInstanceQuery().processInstanceId(id).singleResult() before renaming.
  2. Correct the id source (use the id returned when the instance was started).
  3. Confirm the command runs on the ProcessEngine whose database contains the instance.

Example fix

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

Strategy: validation

Validate before calling

ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(id).singleResult();
if (pi != null) runtimeService.setProcessInstanceName(id, name);

Try / catch

try {
    runtimeService.setProcessInstanceName(id, name);
} catch (FlowableObjectNotFoundException e) {
    log.info("Process instance {} no longer running; skipping rename", id);
}

Prevention

When it happens

Trigger: Calling runtimeService.setProcessInstanceName(id, name) with an id of a process instance that has completed, been deleted, never existed, or belongs to a different engine instance/database.

Common situations: Renaming an instance after it already finished; stale ids cached in a UI or job queue; multi-tenant/multi-engine setups where the command runs against the wrong ProcessEngine.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SetProcessInstanceNameCmd.java:61

            throw new FlowableIllegalArgumentException("processInstanceId is null");
        }

        ExecutionEntity execution = CommandContextUtil.getExecutionEntityManager(commandContext).findById(processInstanceId);
        
        if (execution == null) {
            
            if (CommandContextUtil.getProcessEngineConfiguration(commandContext).isFlowable5CompatibilityEnabled()) {
                Flowable5CompatibilityHandler compatibilityHandler = Flowable5Util.getFlowable5CompatibilityHandler();
                if (compatibilityHandler != null) {
                    ProcessInstance processInstance = compatibilityHandler.getProcessInstance(processInstanceId);
                    if (processInstance != null) {
                        compatibilityHandler.setProcessInstanceName(processInstance.getId(), name);
                        return null;
                    }
                }
            }
            
            throw new FlowableObjectNotFoundException("process instance " + processInstanceId + " doesn't exist", ProcessInstance.class);
        }
        
        if (!execution.isProcessInstanceType()) {
            throw new FlowableObjectNotFoundException("process instance " + processInstanceId + " doesn't exist, the given ID references an execution, though", ProcessInstance.class);
        }

        if (execution.isSuspended()) {
            throw new FlowableException("process instance " + processInstanceId + " is suspended, cannot set name");
        }

        // Actually set the name
        execution.setName(name);

        // Record the change in history
        CommandContextUtil.getHistoryManager(commandContext).recordProcessInstanceNameChange(execution, name);

        return null;
    }

View on GitHub (pinned to d6d39ce1c6)