{"record":{"id":"9e749963ef08cc33","repo":"flowable/flowable-engine","slug":"process-instance-processinstanceid-doesn-t-exis","errorCode":null,"errorMessage":"process instance ${processInstanceId} doesn't exist","messagePattern":"process instance (.+?) doesn't exist","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SetProcessInstanceNameCmd.java","lineNumber":61,"sourceCode":"            throw new FlowableIllegalArgumentException(\"processInstanceId is null\");\n        }\n\n        ExecutionEntity execution = CommandContextUtil.getExecutionEntityManager(commandContext).findById(processInstanceId);\n        \n        if (execution == null) {\n            \n            if (CommandContextUtil.getProcessEngineConfiguration(commandContext).isFlowable5CompatibilityEnabled()) {\n                Flowable5CompatibilityHandler compatibilityHandler = Flowable5Util.getFlowable5CompatibilityHandler();\n                if (compatibilityHandler != null) {\n                    ProcessInstance processInstance = compatibilityHandler.getProcessInstance(processInstanceId);\n                    if (processInstance != null) {\n                        compatibilityHandler.setProcessInstanceName(processInstance.getId(), name);\n                        return null;\n                    }\n                }\n            }\n            \n            throw new FlowableObjectNotFoundException(\"process instance \" + processInstanceId + \" doesn't exist\", ProcessInstance.class);\n        }\n        \n        if (!execution.isProcessInstanceType()) {\n            throw new FlowableObjectNotFoundException(\"process instance \" + processInstanceId + \" doesn't exist, the given ID references an execution, though\", ProcessInstance.class);\n        }\n\n        if (execution.isSuspended()) {\n            throw new FlowableException(\"process instance \" + processInstanceId + \" is suspended, cannot set name\");\n        }\n\n        // Actually set the name\n        execution.setName(name);\n\n        // Record the change in history\n        CommandContextUtil.getHistoryManager(commandContext).recordProcessInstanceNameChange(execution, name);\n\n        return null;\n    }","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SetProcessInstanceNameCmd.java#L43-L79","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the instance still exists via runtimeService.createProcessInstanceQuery().processInstanceId(id).singleResult() before renaming.","Correct the id source (use the id returned when the instance was started).","Confirm the command runs on the ProcessEngine whose database contains the instance."],"exampleFix":"// before\nruntimeService.setProcessInstanceName(id, name);\n// after\nProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(id).singleResult();\nif (pi != null) runtimeService.setProcessInstanceName(id, name);","handlingStrategy":"validation","validationCode":"ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(id).singleResult();\nif (pi != null) runtimeService.setProcessInstanceName(id, name);","typeGuard":null,"tryCatchPattern":"try {\n    runtimeService.setProcessInstanceName(id, name);\n} catch (FlowableObjectNotFoundException e) {\n    log.info(\"Process instance {} no longer running; skipping rename\", id);\n}","preventionTips":["Check instance existence with a ProcessInstanceQuery before mutation","Treat completed/deleted instances as expected in async workflows","Ensure all engines in multi-engine setups point at the same database"],"tags":["flowable","process-instance","not-found"],"backgroundTag":"resource-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"}