{"record":{"id":"6643cf933d1b628a","repo":"flowable/flowable-engine","slug":"no-process-definition-found-for-key-processdefin-6643cf","errorCode":null,"errorMessage":"No process definition found for key '<processDefinitionKey>' for tenant identifier <tenantId>","messagePattern":"No process definition found for key '<processDefinitionKey>' for tenant identifier <tenantId>","errorType":"exception","errorClass":"ActivitiObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/StartProcessInstanceCmd.java","lineNumber":90,"sourceCode":"                .getProcessEngineConfiguration()\n                .getDeploymentManager();\n\n        // Find the process definition\n        ProcessDefinition processDefinition = null;\n        if (processDefinitionId != null) {\n            processDefinition = deploymentManager.findDeployedProcessDefinitionById(processDefinitionId);\n            if (processDefinition == null) {\n                throw new ActivitiObjectNotFoundException(\"No process definition found for id = '\" + processDefinitionId + \"'\", ProcessDefinition.class);\n            }\n        } else if (processDefinitionKey != null && (tenantId == null || ProcessEngineConfiguration.NO_TENANT_ID.equals(tenantId))) {\n            processDefinition = deploymentManager.findDeployedLatestProcessDefinitionByKey(processDefinitionKey);\n            if (processDefinition == null) {\n                throw new ActivitiObjectNotFoundException(\"No process definition found for key '\" + processDefinitionKey + \"'\", ProcessDefinition.class);\n            }\n        } else if (processDefinitionKey != null && tenantId != null && !ProcessEngineConfiguration.NO_TENANT_ID.equals(tenantId)) {\n            processDefinition = deploymentManager.findDeployedLatestProcessDefinitionByKeyAndTenantId(processDefinitionKey, tenantId);\n            if (processDefinition == null) {\n                throw new ActivitiObjectNotFoundException(\"No process definition found for key '\" + processDefinitionKey + \"' for tenant identifier \" + tenantId, ProcessDefinition.class);\n            }\n        } else {\n            throw new ActivitiIllegalArgumentException(\"processDefinitionKey and processDefinitionId are null\");\n        }\n\n        // Do not start process a process instance if the process definition is suspended\n        if (deploymentManager.isProcessDefinitionSuspended(processDefinition.getId())) {\n            throw new ActivitiException(\"Cannot start process instance. Process definition \"\n                    + processDefinition.getName() + \" (id = \" + processDefinition.getId() + \") is suspended\");\n        }\n\n        // Start the process instance\n        ExecutionEntity processInstance = ((ProcessDefinitionEntity) processDefinition).createProcessInstance(businessKey);\n\n        // now set the variables passed into the start command\n        initializeVariables(processInstance);\n\n        // now set processInstance name","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/StartProcessInstanceCmd.java#L72-L108","documentation":"Thrown by StartProcessInstanceCmd.execute() as ActivitiObjectNotFoundException when starting by key with an explicit tenantId and findDeployedLatestProcessDefinitionByKeyAndTenantId returns null. The engine cannot find a deployed latest definition for that key under the given tenant identifier.","triggerScenarios":"RuntimeService.startProcessInstanceByKey(key, tenantId) (or ProcessInstantiationBuilder with tenantId) where no definition with that key is deployed for that tenant — the definition may exist only for the default tenant or another tenant.","commonSituations":"Multi-tenant deployments where a BPMN resource was deployed without tenantId but started with one (or vice versa); typos in tenant identifiers; tenant onboarding scripts skipped a deployment.","solutions":["Deploy the definition for that tenant: repositoryService.createDeployment().tenantId(tenantId).addClasspathResource(...).deploy().","Verify with createProcessDefinitionQuery().processDefinitionKey(key).processDefinitionTenantId(tenantId).list() before starting.","Check the tenantId string matches exactly the tenant used at deployment time (case-sensitive).","If the tenant should share the default definition, start without tenantId (or with NO_TENANT_ID)."],"exampleFix":"// before\nruntimeService.startProcessInstanceByKey(\"orderProcess\", \"tenantA\"); // deployed without tenant\n// after\nrepositoryService.createDeployment()\n    .tenantId(\"tenantA\")\n    .addClasspathResource(\"processes/orderProcess.bpmn20.xml\")\n    .deploy();\nruntimeService.startProcessInstanceByKey(\"orderProcess\", \"tenantA\");","handlingStrategy":"validation","validationCode":"if (repositoryService.createProcessDefinitionQuery()\n        .processDefinitionKey(definitionKey)\n        .processDefinitionTenantId(tenantId).count() == 0) {\n    throw new IllegalStateException(\"No definition for key '\" + definitionKey\n        + \"' and tenant '\" + tenantId + \"'\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    return runtimeService.startProcessInstanceByKey(definitionKey, tenantId, vars);\n} catch (ActivitiObjectNotFoundException e) {\n    log.error(\"No definition for key '{}' tenant '{}'\", definitionKey, tenantId, e);\n    throw e;\n}","preventionTips":["Always deploy tenant-scoped BPMN with .tenantId(tenantId) on the deployment builder","Keep tenant identifiers in one constants/enum source to avoid typos","Add per-tenant deployment verification to onboarding scripts","Decide one convention: either all tenants get deployments, or shared default — enforce it"],"tags":["process-definition","not-found","tenant","multi-tenancy"],"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-14T11:17:12.474Z"}