{"record":{"id":"8e1ef1eeeca68968","repo":"flowable/flowable-engine","slug":"process-definition-with-key-processdefinitionkey","errorCode":null,"errorMessage":"Process definition with key '{processDefinitionKey}' and tenantId '{tenantId}' was not found","messagePattern":"Process definition with key '(.+?)' and tenantId '(.+?)' was not found","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/AbstractProcessStartEventSubscriptionCmd.java","lineNumber":97,"sourceCode":"\n            if (processDefinition == null) {\n                ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);\n                if (processEngineConfiguration.isFallbackToDefaultTenant()) {\n                    String defaultTenant = processEngineConfiguration.getDefaultTenantProvider().getDefaultTenant(tenantId, ScopeTypes.BPMN, processDefinitionKey);\n                    if (StringUtils.isNotEmpty(defaultTenant)) {\n                        processDefinition = processDefinitionEntityManager.findLatestProcessDefinitionByKeyAndTenantId(processDefinitionKey, defaultTenant);\n                        \n                    } else {\n                        processDefinition = processDefinitionEntityManager.findLatestProcessDefinitionByKey(processDefinitionKey);\n                    }\n                    \n                    if (processDefinition == null) {\n                        throw new FlowableObjectNotFoundException(\"No process definition found for key '\" + processDefinitionKey +\n                            \"'. Fallback to default tenant was also applied.\", ProcessDefinition.class);\n                    }\n                    \n                } else {\n                    throw new FlowableObjectNotFoundException(\"Process definition with key '\" + processDefinitionKey +\n                        \"' and tenantId '\"+ tenantId +\"' was not found\", ProcessDefinition.class);\n                }\n            }\n\n        }\n        \n        if (processDefinition == null) {\n            throw new FlowableIllegalArgumentException(\"No deployed process definition found for key '\" + processDefinitionKey + \"'.\");\n        }\n        \n        return processDefinition;\n    }\n\n    protected ProcessDefinition getProcessDefinitionById(String processDefinitionId, CommandContext commandContext) {\n        RepositoryService repositoryService = CommandContextUtil.getProcessEngineConfiguration(commandContext).getRepositoryService();\n\n        ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()\n            .processDefinitionId(processDefinitionId)","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/AbstractProcessStartEventSubscriptionCmd.java#L79-L115","documentation":"Flowable throws this when a tenantId was supplied but no process definition exists with that key and tenant, and the fallback-to-default-tenant branch was not applicable/failed to produce a definition. It distinguishes the tenant-scoped miss from the plain key miss.","triggerScenarios":"Calling getLatestProcessDefinitionByKey via a start-event subscription command with a non-null tenantId (different from NO_TENANT_ID) where findLatestProcessDefinitionByKeyAndTenantId returned an empty result and the subsequent default-tenant lookup also failed (the else branch fires when the fallback path conditions are not met).","commonSituations":"Definition deployed under the default tenant while a tenantId is passed at lookup; tenant configured in a process instance/query that does not match any deployment tenant.","solutions":["Deploy the definition with a deployment whose tenantId matches the lookup tenantId","List definitions per tenant with createProcessDefinitionQuery().processDefinitionTenantId(tenantId, true) to confirm the exact tenant","Remove or correct the tenantId argument if the deployment has no tenant","Align tenant propagation in your application (e.g. TenantContext) with deployment tenants"],"exampleFix":"// before\ngetProcessDefinition(key, \"acme-tenant\"); // deployed without tenant\n// after\nrepositoryService.createDeployment().addClasspathResource(\"p.bpmn\").tenantId(\"acme-tenant\").deploy();","handlingStrategy":"validation","validationCode":"if (repositoryService.createProcessDefinitionQuery()\n        .processDefinitionKey(key).processDefinitionTenantId(tenantId, true).count() == 0) {\n    throw new IllegalStateException(\"Deploy definition for tenant \" + tenantId + \" first\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    // tenant-scoped call\n} catch (FlowableObjectNotFoundException e) {\n    // treat as tenant/deployment misconfiguration; alert instead of retry\n}","preventionTips":["Keep a deployment manifest mapping each tenant to its BPMN resources","Automate per-tenant deployments in CI","Validate tenant propagation from request context before engine calls"],"tags":["flowable","multi-tenant","process-definition","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-14T05:17:10.506Z"}