{"record":{"id":"af01bcaf8d62795c","repo":"flowable/flowable-engine","slug":"no-process-instance-found-for-id-processinsta-af01bc","errorCode":null,"errorMessage":"No process instance found for id = '${processInstanceId}'.","messagePattern":"No process instance found for id = '(.+?)'\\.","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/UpdateProcessInstanceCmd.java","lineNumber":53,"sourceCode":"    private static final long serialVersionUID = 1L;\n\n    protected ProcessInstanceUpdateBuilderImpl builder;\n\n    public UpdateProcessInstanceCmd(ProcessInstanceUpdateBuilderImpl builder) {\n        this.builder = builder;\n    }\n\n    @Override\n    public Void execute(CommandContext commandContext) {\n        String processInstanceId = builder.getProcessInstanceId();\n        if (processInstanceId == null || processInstanceId.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"The process instance id is mandatory, but '\" + processInstanceId + \"' has been provided.\");\n        }\n\n        ExecutionEntityManager executionManager = CommandContextUtil.getExecutionEntityManager(commandContext);\n        ExecutionEntity processInstance = executionManager.findById(processInstanceId);\n        if (processInstance == null) {\n            throw new FlowableObjectNotFoundException(\"No process instance found for id = '\" + processInstanceId + \"'.\", ProcessInstance.class);\n        } else if (!processInstance.isProcessInstanceType()) {\n            throw new FlowableIllegalArgumentException(\"A process instance id is required, but the provided id '\" + processInstanceId\n                    + \"' points to a child execution of process instance '\" + processInstance.getProcessInstanceId() + \"'.\");\n        }\n\n        if (builder.isBusinessKeySet()) {\n            executionManager.updateProcessInstanceBusinessKey(processInstance, builder.getBusinessKey());\n        }\n\n        if (builder.isBusinessStatusSet()) {\n            executionManager.updateProcessInstanceBusinessStatus(processInstance, builder.getBusinessStatus());\n        }\n\n        if (builder.isNameSet()) {\n            processInstance.setName(builder.getName());\n            ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);\n            processEngineConfiguration.getHistoryManager().recordProcessInstanceNameChange(processInstance, builder.getName());\n        }","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/UpdateProcessInstanceCmd.java#L35-L71","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the id exists before updating: runtimeService.createProcessInstanceQuery().processInstanceId(id).singleResult() != null.","Check you are connected to the same database/schema the instance was created in (JDBC url, catalog, tenant config).","Re-fetch the id instead of reusing a stored value; if the instance finished, handle the finished case instead of updating.","Enable Flowable debug logging on the ExecutionEntityManager to see the executed lookup query and confirm the missing row."],"exampleFix":"// before\nruntimeService.setProcessInstanceName(processInstanceId, name); // throws if id unknown\n// after\nProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();\nif (pi != null) {\n    runtimeService.setProcessInstanceName(processInstanceId, name);\n}","handlingStrategy":"validation","validationCode":"if (runtimeService.createProcessInstanceQuery().processInstanceId(id).singleResult() == null) { throw new IllegalArgumentException(\"Unknown process instance: \" + id); }","typeGuard":"boolean processInstanceExists(RuntimeService rs, String id) { return id != null && !id.isEmpty() && rs.createProcessInstanceQuery().processInstanceId(id).singleResult() != null; }","tryCatchPattern":"try { runtimeService.setProcessInstanceName(id, name); } catch (FlowableObjectNotFoundException e) { LOG.warn(\"process instance gone: {}\", id); }","preventionTips":["Always resolve fresh ids from ProcessInstanceQuery before instance-level updates","Handle instance-finished as a normal business case, not an exception path","Confirm all environments point at the intended database schema"],"tags":["process-instance","not-found","runtime"],"backgroundTag":"record-not-found","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}