flowable/flowable-engine · error · FlowableObjectNotFoundException

No process instance found for id =

Error message

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

What it means

Thrown by SetProcessInstanceBusinessStatusCmd.execute when no execution exists with the supplied id, wrapped as a FlowableObjectNotFoundException with ProcessInstance.class. It indicates the runtime record is gone or the id never existed.

Solutions

  1. Check existence first via RuntimeService.createProcessInstanceQuery().processInstanceId(id).
  2. Guard with try-catch on FlowableObjectNotFoundException for benign races with process end.
  3. Verify datasource/tenant configuration matches where the instance was created.

Example fix

// before
runtimeService.setProcessInstanceBusinessStatus(id, status);
// after
if (runtimeService.createProcessInstanceQuery().processInstanceId(id).count() > 0) {
    runtimeService.setProcessInstanceBusinessStatus(id, status);
}
Defensive patterns

Strategy: try-catch

Validate before calling

boolean exists = runtimeService.createProcessInstanceQuery()
        .processInstanceId(processInstanceId).count() > 0;

Try / catch

try {
    runtimeService.setProcessInstanceBusinessStatus(id, status);
} catch (FlowableObjectNotFoundException e) {
    if (ProcessInstance.class.equals(e.getObjectClass())) {
        // instance already ended; no-op or alert
    }
}

Prevention

When it happens

Trigger: RuntimeService.setProcessInstanceBusinessStatus(id, status) where executionManager.findById(id) returns null: instance already ended, wrong id, wrong database/tenant.

Common situations: Updating status after process completion (e.g. from an async listener), stale ids cached across restarts, pointing at a test database in production config.

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


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

Appendix: source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SetProcessInstanceBusinessStatusCmd.java:57

    public SetProcessInstanceBusinessStatusCmd(String processInstanceId, String businessStatus) {
        if (processInstanceId == null || processInstanceId.isEmpty()) {
            throw new FlowableIllegalArgumentException("The process instance id is mandatory, but '" + processInstanceId + "' has been provided.");
        }
        if (businessStatus == null) {
            throw new FlowableIllegalArgumentException("The business status is mandatory, but 'null' has been provided.");
        }

        this.processInstanceId = processInstanceId;
        this.businessStatus = businessStatus;
    }

    @Override
    public Void execute(CommandContext commandContext) {
        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.");
        }

        executionManager.updateProcessInstanceBusinessStatus(processInstance, businessStatus);

        return null;
    }
}

View on GitHub (pinned to d6d39ce1c6)