{"record":{"id":"a76c924dc644a6a3","repo":"flowable/flowable-engine","slug":"cannot-find-process-definition-with-id-processde","errorCode":null,"errorMessage":"Cannot find process definition with id ${processDefinitionId}","messagePattern":"Cannot find process definition with id (.+?)","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/DeleteIdentityLinkForProcessDefinitionCmd.java","lineNumber":65,"sourceCode":"    }\n\n    protected void validateParams(String userId, String groupId, String processDefinitionId) {\n        if (processDefinitionId == null) {\n            throw new FlowableIllegalArgumentException(\"processDefinitionId is null\");\n        }\n\n        if (userId == null && groupId == null) {\n            throw new FlowableIllegalArgumentException(\"userId and groupId cannot both be null\");\n        }\n    }\n\n    @Override\n    public Void execute(CommandContext commandContext) {\n        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);\n        ProcessDefinitionEntity processDefinition = processEngineConfiguration.getProcessDefinitionEntityManager().findById(processDefinitionId);\n\n        if (processDefinition == null) {\n            throw new FlowableObjectNotFoundException(\"Cannot find process definition with id \" + processDefinitionId, ProcessDefinition.class);\n        }\n\n        if (Flowable5Util.isFlowable5ProcessDefinition(processDefinition, commandContext)) {\n            Flowable5CompatibilityHandler compatibilityHandler = Flowable5Util.getFlowable5CompatibilityHandler();\n            compatibilityHandler.deleteCandidateStarter(processDefinitionId, userId, groupId);\n            return null;\n        }\n\n        processEngineConfiguration.getIdentityLinkServiceConfiguration().getIdentityLinkService()\n            .deleteProcessDefinitionIdentityLink(processDefinition.getId(), userId, groupId);\n\n        return null;\n    }\n\n}\n","sourceCodeStart":47,"sourceCodeEnd":81,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/DeleteIdentityLinkForProcessDefinitionCmd.java#L47-L81","documentation":"After parameter validation, DeleteIdentityLinkForProcessDefinitionCmd looks up the process definition entity by id. If the entity manager returns null (id never existed, or the definition was deleted), Flowable throws FlowableObjectNotFoundException with ProcessDefinition.class as the reference type.","triggerScenarios":"Calling deleteProcessDefinitionIdentityLink / deleteCandidateStarterUser with a processDefinitionId that does not match any deployed definition, or that belonged to a since-deleted deployment.","commonSituations":"Hard-coded ids from another environment (test vs prod); definition deleted via cascade deployment cleanup; tenant-specific lookups returning a different definition than expected.","solutions":["Verify the id with repositoryService.createProcessDefinitionQuery().processDefinitionId(id).singleResult() before deleting the link.","If the id came from another environment, re-resolve it by key and version (processDefinitionQuery().processDefinitionKeyLatestVersion()).","Handle FlowableObjectNotFoundException gracefully if the definition may have been undeployed concurrently."],"exampleFix":"// before\nrepositoryService.deleteCandidateStarterUser(processDefinitionId, userId);\n// after\nProcessDefinition pd = repositoryService.createProcessDefinitionQuery()\n        .processDefinitionId(processDefinitionId).singleResult();\nif (pd != null) {\n    repositoryService.deleteCandidateStarterUser(processDefinitionId, userId);\n}","handlingStrategy":"validation","validationCode":"ProcessDefinition pd = repositoryService.createProcessDefinitionQuery()\n        .processDefinitionId(pdId).singleResult();\nif (pd == null) {\n    throw new IllegalStateException(\"Unknown process definition: \" + pdId);\n}","typeGuard":"boolean definitionExists(RepositoryService rs, String pdId) {\n    return pdId != null && rs.createProcessDefinitionQuery().processDefinitionId(pdId).count() > 0;\n}","tryCatchPattern":"try {\n    repositoryService.deleteCandidateStarterUser(pdId, userId);\n} catch (FlowableObjectNotFoundException e) {\n    log.warn(\"Process definition {} no longer exists; skipping link deletion\", pdId);\n}","preventionTips":["Never hard-code definition ids across environments; resolve by key/latest version.","Re-resolve ids after deployments or deployment cascades that delete definitions.","Treat not-found on delete as idempotent in cleanup jobs."],"tags":["flowable","process-definition","not-found","identity-link"],"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"}