{"record":{"id":"7b6fbe042d61fa0c","repo":"flowable/flowable-engine","slug":"no-processes-deployed-with-key-processdefiniti","errorCode":null,"errorMessage":"no processes deployed with key = '<processDefinitionKey>' and version = '<processDefinitionVersion>'","messagePattern":"no processes deployed with key = '<processDefinitionKey>' and version = '<processDefinitionVersion>'","errorType":"exception","errorClass":"ActivitiObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/persistence/deploy/DeploymentManager.java","lineNumber":174,"sourceCode":"    public ProcessDefinition findDeployedLatestProcessDefinitionByKeyAndTenantId(String processDefinitionKey, String tenantId) {\n        ProcessDefinition processDefinition = Context\n                .getCommandContext()\n                .getProcessDefinitionEntityManager()\n                .findLatestProcessDefinitionByKeyAndTenantId(processDefinitionKey, tenantId);\n        if (processDefinition == null) {\n            throw new ActivitiObjectNotFoundException(\"no processes deployed with key '\" + processDefinitionKey + \"' for tenant identifier '\" + tenantId + \"'\", ProcessDefinition.class);\n        }\n        processDefinition = resolveProcessDefinition(processDefinition).getProcessDefinition();\n        return processDefinition;\n    }\n\n    public ProcessDefinition findDeployedProcessDefinitionByKeyAndVersion(String processDefinitionKey, Integer processDefinitionVersion) {\n        ProcessDefinition processDefinition = (ProcessDefinitionEntity) Context\n                .getCommandContext()\n                .getProcessDefinitionEntityManager()\n                .findProcessDefinitionByKeyAndVersion(processDefinitionKey, processDefinitionVersion);\n        if (processDefinition == null) {\n            throw new ActivitiObjectNotFoundException(\"no processes deployed with key = '\" + processDefinitionKey + \"' and version = '\" + processDefinitionVersion + \"'\", ProcessDefinition.class);\n        }\n        processDefinition = resolveProcessDefinition(processDefinition).getProcessDefinition();\n        return processDefinition;\n    }\n\n    public ProcessDefinitionCacheEntry resolveProcessDefinition(ProcessDefinition processDefinition) {\n        String processDefinitionId = processDefinition.getId();\n        String deploymentId = processDefinition.getDeploymentId();\n        ProcessDefinitionCacheEntry cachedProcessDefinition = processDefinitionCache.get(processDefinitionId);\n        if (cachedProcessDefinition == null) {\n            DeploymentEntity deployment = Context\n                    .getCommandContext()\n                    .getDeploymentEntityManager()\n                    .findDeploymentById(deploymentId);\n            deployment.setNew(false);\n            deploy(deployment, null);\n            cachedProcessDefinition = processDefinitionCache.get(processDefinitionId);\n","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/persistence/deploy/DeploymentManager.java#L156-L192","documentation":"ActivitiObjectNotFoundException thrown by DeploymentManager.findDeployedProcessDefinitionByKeyAndVersion when no process definition matches both the given key and exact version number. The entity manager query returns null and the manager raises this error. Both conditions must match simultaneously — the key may exist but not at that version.","triggerScenarios":"Calling newProcessDefinition-related flows or RuntimeService.startProcessInstanceByKeyAndVersion? wait — this method is internal — practically: any API resolving a definition by key+version (e.g., startProcessInstanceByMessage/DTO flows) where the requested version was never deployed or was removed by deleteDeployment.","commonSituations":"Hard-coding version numbers that shift after redeployment (auto-incremented versions), requesting version 1 after multiple redeployments cleaned old versions, off-by-one assumptions about the current version.","solutions":["Check available versions: repositoryService.createProcessDefinitionQuery().processDefinitionKey(key).list() and inspect getVersion()","Use latestVersion() query instead of pinning an explicit version","Deploy the missing version if it is genuinely required","If pinning is intentional, derive the version dynamically instead of hard-coding"],"exampleFix":"// before\nProcessDefinition pd = repositoryService.createProcessDefinitionQuery()\n    .processDefinitionKey(\"OrderProcess\").processDefinitionVersion(2).singleResult();\n// after\nProcessDefinition pd = repositoryService.createProcessDefinitionQuery()\n    .processDefinitionKey(\"OrderProcess\").latestVersion().singleResult();","handlingStrategy":"validation","validationCode":"List<ProcessDefinition> versions = repositoryService.createProcessDefinitionQuery()\n    .processDefinitionKey(key).orderByProcessDefinitionVersion().desc().list();\nif (versions.stream().noneMatch(pd -> version.equals(pd.getVersion()))) {\n    throw new IllegalStateException(\"Version \" + version + \" not deployed for key \" + key);\n}","typeGuard":null,"tryCatchPattern":"try {\n    pd = findDeployedProcessDefinitionByKeyAndVersion(key, version);\n} catch (ActivitiObjectNotFoundException e) {\n    pd = repositoryService.createProcessDefinitionQuery()\n        .processDefinitionKey(key).latestVersion().singleResult();\n}","preventionTips":["Avoid hard-coding version numbers; versions auto-increment per redeploy","Pin versions explicitly only when you also pin the deployment","Check version availability before switching traffic to a pinned version"],"tags":["process-definition","version","not-found","deployment"],"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"}