{"record":{"id":"e22aeb87a2d1fe2f","repo":"flowable/flowable-engine","slug":"cannot-find-bpmn-model-for-process-definition-id","errorCode":null,"errorMessage":"Cannot find bpmn model for process definition id: ${processDefinitionId}","messagePattern":"Cannot find bpmn model for process definition id: (.+?)","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetDecisionsForProcessDefinitionCmd.java","lineNumber":61,"sourceCode":"    protected String processDefinitionId;\n    protected DmnRepositoryService dmnRepositoryService;\n\n    public GetDecisionsForProcessDefinitionCmd(String processDefinitionId) {\n        this.processDefinitionId = processDefinitionId;\n    }\n\n    @Override\n    public List<DmnDecision> execute(CommandContext commandContext) {\n        ProcessDefinition processDefinition = ProcessDefinitionUtil.getProcessDefinition(processDefinitionId);\n\n        if (processDefinition == null) {\n            throw new FlowableObjectNotFoundException(\"Cannot find process definition for id: \" + processDefinitionId, ProcessDefinition.class);\n        }\n\n        BpmnModel bpmnModel = ProcessDefinitionUtil.getBpmnModel(processDefinitionId);\n\n        if (bpmnModel == null) {\n            throw new FlowableObjectNotFoundException(\"Cannot find bpmn model for process definition id: \" + processDefinitionId, BpmnModel.class);\n        }\n\n        if (CommandContextUtil.getDmnRepositoryService() == null) {\n            throw new FlowableException(\"DMN repository service is not available\");\n        }\n\n        dmnRepositoryService = CommandContextUtil.getDmnRepositoryService();\n        List<DmnDecision> decisions = getDecisionsFromModel(bpmnModel, processDefinition);\n\n        return decisions;\n    }\n\n    protected List<DmnDecision> getDecisionsFromModel(BpmnModel bpmnModel, ProcessDefinition processDefinition) {\n        Set<String> decisionKeys = new HashSet<>();\n        List<DmnDecision> decisions = new ArrayList<>();\n        List<ServiceTask> serviceTasks = bpmnModel.getMainProcess().findFlowElementsOfType(ServiceTask.class, true);\n\n        for (ServiceTask serviceTask : serviceTasks) {","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetDecisionsForProcessDefinitionCmd.java#L43-L79","documentation":"FlowableObjectNotFoundException thrown by GetDecisionsForProcessDefinitionCmd.execute when ProcessDefinitionUtil.getBpmnModel(processDefinitionId) returns null. The process definition id was resolvable (or the util returned nothing usable), but no BpmnModel could be loaded for it, so the command cannot read decision keys from the model. Flowable throws this because decision-table / DMN references are attached to the BPMN model, which is mandatory for this lookup.","triggerScenarios":"Calling RepositoryService.getDecisionsForProcessDefinition(processDefinitionId) (or the runtime counterpart) with an id whose BPMN XML resource is missing from the deployment, was corrupted, or whose deployment was deleted; ProcessDefinitionUtil.getBpmnModel resolves the definition but cannot return its BpmnModel.","commonSituations":"Deployments built manually without the .bpmn resource; database rows deleted or restored inconsistently (process definition present, ACT_GE_BYTEARRAY model resource gone); multi-tenant/case engines (CMMN) where DMN is not wired in; querying a definition from a stale cache after redeploy.","solutions":["Verify the process definition exists and its deployment still contains the BPMN XML resource: RepositoryService.getDeploymentResourceNames(deploymentId).","Catch FlowableObjectNotFoundException and treat the id as invalid; re-resolve the latest definition id via RepositoryService.createProcessDefinitionQuery().latestVersion().","If data is inconsistent, redeploy the BPMN file to recreate the model resource, or repair the deployment rows in ACT_RE_PROCDEF / ACT_GE_BYTEARRAY.","Confirm the DMN repository service is available in the engine configuration if running in a standalone/custom engine setup."],"exampleFix":"// before\nList<DmnDecision> decisions = repositoryService.getDecisionsForProcessDefinition(unknownId);\n// after\nProcessDefinition pd = repositoryService.createProcessDefinitionQuery().processDefinitionId(id).singleResult();\nif (pd == null) throw new IllegalArgumentException(\"Unknown process definition: \" + id);\nList<DmnDecision> decisions = repositoryService.getDecisionsForProcessDefinition(id);","handlingStrategy":"try-catch","validationCode":"ProcessDefinition pd = repositoryService.createProcessDefinitionQuery().processDefinitionId(id).singleResult();\nif (pd == null) throw new IllegalArgumentException(\"unknown processDefinitionId: \" + id);","typeGuard":"boolean isValidDefinitionId(String id) {\n    return id != null && !id.isBlank()\n        && repositoryService.createProcessDefinitionQuery().processDefinitionId(id).count() > 0;\n}","tryCatchPattern":"try {\n    return repositoryService.getDecisionsForProcessDefinition(id);\n} catch (FlowableObjectNotFoundException e) {\n    log.warn(\"No BPMN model for definition {}: {}\", id, e.getMessage());\n    return Collections.emptyList();\n}","preventionTips":["Always deploy via the standard RepositoryService deployment builder so BPMN resources are stored with the deployment.","Verify deployment resources after deploy (getDeploymentResourceNames) in integration tests.","Resolve definition ids through ProcessDefinitionQuery rather than caching raw ids.","Ensure the DMN engine is wired up when using decision-table references."],"tags":["flowable","bpmn","resource-not-found","dmn"],"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"}