{"record":{"id":"4391569e55c12a66","repo":"flowable/flowable-engine","slug":"no-process-instance-found-for-id-processinsta-439156","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/SetProcessInstanceBusinessStatusCmd.java","lineNumber":57,"sourceCode":"\n    public SetProcessInstanceBusinessStatusCmd(String processInstanceId, String businessStatus) {\n        if (processInstanceId == null || processInstanceId.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"The process instance id is mandatory, but '\" + processInstanceId + \"' has been provided.\");\n        }\n        if (businessStatus == null) {\n            throw new FlowableIllegalArgumentException(\"The business status is mandatory, but 'null' has been provided.\");\n        }\n\n        this.processInstanceId = processInstanceId;\n        this.businessStatus = businessStatus;\n    }\n\n    @Override\n    public Void execute(CommandContext commandContext) {\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\n        } else if (!processInstance.isProcessInstanceType()) {\n            throw new FlowableIllegalArgumentException(\"A process instance id is required, but the provided id \" + \"'\" + processInstanceId + \"' \" + \"points to a child execution of process instance \" + \"'\"\n                    + processInstance.getProcessInstanceId() + \"'. \" + \"Please invoke the \" + getClass().getSimpleName() + \" with a root execution id.\");\n        }\n\n        executionManager.updateProcessInstanceBusinessStatus(processInstance, businessStatus);\n\n        return null;\n    }\n}\n","sourceCodeStart":39,"sourceCodeEnd":69,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SetProcessInstanceBusinessStatusCmd.java#L39-L69","documentation":"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.","triggerScenarios":"RuntimeService.setProcessInstanceBusinessStatus(id, status) where executionManager.findById(id) returns null: instance already ended, wrong id, wrong database/tenant.","commonSituations":"Updating status after process completion (e.g. from an async listener), stale ids cached across restarts, pointing at a test database in production config.","solutions":["Check existence first via RuntimeService.createProcessInstanceQuery().processInstanceId(id).","Guard with try-catch on FlowableObjectNotFoundException for benign races with process end.","Verify datasource/tenant configuration matches where the instance was created."],"exampleFix":"// before\nruntimeService.setProcessInstanceBusinessStatus(id, status);\n// after\nif (runtimeService.createProcessInstanceQuery().processInstanceId(id).count() > 0) {\n    runtimeService.setProcessInstanceBusinessStatus(id, status);\n}","handlingStrategy":"try-catch","validationCode":"boolean exists = runtimeService.createProcessInstanceQuery()\n        .processInstanceId(processInstanceId).count() > 0;","typeGuard":null,"tryCatchPattern":"try {\n    runtimeService.setProcessInstanceBusinessStatus(id, status);\n} catch (FlowableObjectNotFoundException e) {\n    if (ProcessInstance.class.equals(e.getObjectClass())) {\n        // instance already ended; no-op or alert\n    }\n}","preventionTips":["Guard async/scheduled updates against instances that completed meanwhile.","Confirm the id exists before updating from stale caches.","Check datasource and tenant configuration for cross-environment mistakes."],"tags":["process-instance","not-found","runtime"],"backgroundTag":"entity-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"}