flowable/flowable-engine · error · FlowableObjectNotFoundException

process instance ${processInstanceId} doesn't exist, the giv

Error message

process instance ${processInstanceId} doesn't exist, the given ID references an execution, though

What it means

The id passed to SetProcessInstanceNameCmd resolved to an execution, but not to the root process-instance-type execution. Flowable treats 'process instance' as a specific execution type; passing a child execution id is reported as not-found for a ProcessInstance because renaming applies only to the root.

Source

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

        
        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)

Solutions

  1. Convert the execution id to the root id via runtimeService.createExecutionQuery().executionId(id).singleResult().getProcessInstanceId() and pass that.
  2. Prefer task.getProcessInstanceId() over task.getExecutionId() when renaming from a task context.
  3. Only pass ids obtained from ProcessInstance/ProcessInstanceQuery results.

Example fix

// before
runtimeService.setProcessInstanceName(task.getExecutionId(), name);
// after
runtimeService.setProcessInstanceName(task.getProcessInstanceId(), name);
Defensive patterns

Strategy: validation

Validate before calling

Execution exec = runtimeService.createExecutionQuery().executionId(id).singleResult();
if (exec != null && exec.isProcessInstanceType()) {
    runtimeService.setProcessInstanceName(id, name);
}

Try / catch

try {
    runtimeService.setProcessInstanceName(id, name);
} catch (FlowableObjectNotFoundException e) {
    log.warn("{} is an execution, not a process instance", id, e);
}

Prevention

When it happens

Trigger: Calling runtimeService.setProcessInstanceName with an execution id from a concurrent child execution (e.g. taken from a task's executionId) in a process with parallel gateways or call activities.

Common situations: Using task.getExecutionId() instead of the process instance id; ids taken from job or history rows tied to child executions; processes with concurrent branches where multiple executions exist.

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


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