{"record":{"id":"8cba963ff4d2a671","repo":"flowable/flowable-engine","slug":"no-process-definition-found-for-id-processdef","errorCode":null,"errorMessage":"No process definition found for id = '${processDefinitionId}'","messagePattern":"No process definition found for id = '(.+?)'","errorType":"validation","errorClass":"FlowableObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SetProcessDefinitionCategoryCmd.java","lineNumber":55,"sourceCode":"    protected String category;\r\n\r\n    public SetProcessDefinitionCategoryCmd(String processDefinitionId, String category) {\r\n        this.processDefinitionId = processDefinitionId;\r\n        this.category = category;\r\n    }\r\n\r\n    @Override\r\n    public Void execute(CommandContext commandContext) {\r\n\r\n        if (processDefinitionId == null) {\r\n            throw new FlowableIllegalArgumentException(\"Process definition id is null\");\r\n        }\r\n\r\n        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);\r\n        ProcessDefinitionEntity processDefinition = processEngineConfiguration.getProcessDefinitionEntityManager().findById(processDefinitionId);\r\n\r\n        if (processDefinition == null) {\r\n            throw new FlowableObjectNotFoundException(\"No process definition found for id = '\" + processDefinitionId + \"'\", ProcessDefinition.class);\r\n        }\r\n\r\n        if (Flowable5Util.isFlowable5ProcessDefinition(processDefinition, commandContext)) {\r\n            Flowable5CompatibilityHandler compatibilityHandler = Flowable5Util.getFlowable5CompatibilityHandler();\r\n            compatibilityHandler.setProcessDefinitionCategory(processDefinitionId, category);\r\n            return null;\r\n        }\r\n\r\n        // Update category\r\n        processDefinition.setCategory(category);\r\n\r\n        // Remove process definition from cache, it will be refetch later\r\n        DeploymentCache<ProcessDefinitionCacheEntry> processDefinitionCache = processEngineConfiguration.getProcessDefinitionCache();\r\n        if (processDefinitionCache != null) {\r\n            processDefinitionCache.remove(processDefinitionId);\r\n        }\r\n\r\n        FlowableEventDispatcher eventDispatcher = processEngineConfiguration.getEventDispatcher();\r","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SetProcessDefinitionCategoryCmd.java#L37-L73","documentation":"Flowable throws this FlowableObjectNotFoundException when the process definition id supplied to SetProcessDefinitionCategoryCmd is well-formed but no matching ProcessDefinitionEntity exists in the repository. The exception carries ProcessDefinition.class as the object reference, indicating which entity type was not found. The category update does not happen.","triggerScenarios":"Calling RepositoryService.setProcessDefinitionCategory(id, category) with an id that was deleted, never existed, or was mistyped; the definition was removed by deleteDeployment with cascade; querying against a different database or tenant.","commonSituations":"Stale ids cached after re-deployment (new version gets a new id); deleteDeployment cascading away definitions; copying ids between environments; typo in a config file storing the definition id.","solutions":["Look up the current id via RepositoryService.createProcessDefinitionQuery().processDefinitionKey(key).latestVersion().singleResult() and use its getId()","Verify the database/tenant matches where the definition was deployed","Re-deploy the BPMN resource if the definition was deleted","Catch FlowableObjectNotFoundException and treat it as a missing-definition condition if that is expected"],"exampleFix":"// before\nrepositoryService.setProcessDefinitionCategory(\"process:1:4\", \"production\"); // stale id\n// after\nProcessDefinition def = repositoryService.createProcessDefinitionQuery()\n    .processDefinitionKey(\"process\").latestVersion().singleResult();\nrepositoryService.setProcessDefinitionCategory(def.getId(), \"production\");","handlingStrategy":"validation","validationCode":"ProcessDefinition def = repositoryService.createProcessDefinitionQuery()\n    .processDefinitionId(processDefinitionId).singleResult();\nif (def == null) {\n    throw new IllegalStateException(\"No process definition for id \" + processDefinitionId);\n}","typeGuard":"boolean processDefinitionExists(String id) {\n    return id != null && repositoryService.createProcessDefinitionQuery()\n        .processDefinitionId(id).count() > 0;\n}","tryCatchPattern":"try {\n    repositoryService.setProcessDefinitionCategory(id, category);\n} catch (FlowableObjectNotFoundException e) {\n    log.warn(\"Process definition not found: {}\", id, e);\n}","preventionTips":["Look up latest definition by key rather than caching raw ids across re-deployments","Check tenant/database consistency between environments","Catch FlowableObjectNotFoundException when deletions are possible"],"tags":["flowable","not-found","process-definition","java"],"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"}