{"record":{"id":"31c12fc368f12e1c","repo":"flowable/flowable-engine","slug":"process-instance-processinstanceid-doesn-t-exis-31c12f","errorCode":null,"errorMessage":"process instance ${processInstanceId} doesn't exist, the given ID references an execution, though","messagePattern":"process instance (.+?) doesn't exist, the given ID references an execution, though","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SetProcessInstanceNameCmd.java","lineNumber":65,"sourceCode":"        \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    }\n\n}\n","sourceCodeStart":47,"sourceCodeEnd":82,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SetProcessInstanceNameCmd.java#L47-L82","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Convert the execution id to the root id via runtimeService.createExecutionQuery().executionId(id).singleResult().getProcessInstanceId() and pass that.","Prefer task.getProcessInstanceId() over task.getExecutionId() when renaming from a task context.","Only pass ids obtained from ProcessInstance/ProcessInstanceQuery results."],"exampleFix":"// before\nruntimeService.setProcessInstanceName(task.getExecutionId(), name);\n// after\nruntimeService.setProcessInstanceName(task.getProcessInstanceId(), name);","handlingStrategy":"validation","validationCode":"Execution exec = runtimeService.createExecutionQuery().executionId(id).singleResult();\nif (exec != null && exec.isProcessInstanceType()) {\n    runtimeService.setProcessInstanceName(id, name);\n}","typeGuard":null,"tryCatchPattern":"try {\n    runtimeService.setProcessInstanceName(id, name);\n} catch (FlowableObjectNotFoundException e) {\n    log.warn(\"{} is an execution, not a process instance\", id, e);\n}","preventionTips":["Prefer task.getProcessInstanceId() over task.getExecutionId()","Only pass ids returned by ProcessInstanceQuery or startProcessInstance* calls","Watch for processes with parallel branches where child execution ids are easy to grab by mistake"],"tags":["flowable","execution","process-instance","wrong-id"],"backgroundTag":"invalid-argument-value","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}