{"record":{"id":"d3d8ed30afae4665","repo":"flowable/flowable-engine","slug":"cannot-find-bpmn-model-for-process-definition-id-d3d8ed","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/GetFormDefinitionsForProcessDefinitionCmd.java","lineNumber":62,"sourceCode":"    protected String processDefinitionId;\n    protected FormRepositoryService formRepositoryService;\n\n    public GetFormDefinitionsForProcessDefinitionCmd(String processDefinitionId) {\n        this.processDefinitionId = processDefinitionId;\n    }\n\n    @Override\n    public List<FormDefinition> 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.getFormRepositoryService() == null) {\n            throw new FlowableException(\"Form repository service is not available\");\n        }\n\n        formRepositoryService = CommandContextUtil.getFormRepositoryService();\n        List<FormDefinition> formDefinitions = getFormDefinitionsFromModel(bpmnModel, processDefinition);\n\n        return formDefinitions;\n    }\n\n    protected List<FormDefinition> getFormDefinitionsFromModel(BpmnModel bpmnModel, ProcessDefinition processDefinition) {\n        Set<String> formKeys = new HashSet<>();\n        List<FormDefinition> formDefinitions = new ArrayList<>();\n\n        // for all start events\n        List<StartEvent> startEvents = bpmnModel.getMainProcess().findFlowElementsOfType(StartEvent.class, true);","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetFormDefinitionsForProcessDefinitionCmd.java#L44-L80","documentation":"GetFormDefinitionsForProcessDefinitionCmd resolves the BPMN model for a deployed process definition via ProcessDefinitionUtil.getBpmnModel. The engine throws FlowableObjectNotFoundException when that lookup returns null, meaning the definition exists in the command context but no BPMN XML model can be resolved for it. This is a lookup failure, not a user-input validation error.","triggerScenarios":"Executing GetFormDefinitionsForProcessDefinitionCmd with a processDefinitionId whose process definition cannot be resolved to a BpmnModel — e.g. the id points to a definition deployed without BPMN XML resources, the deployment was cleaned from ACT_GE_BYTEARRAY, or a form-related definition id (from another engine/module) is passed instead of a process definition id.","commonSituations":"Mixed form-engine setups where the form repository service is deployed with its own definitions; stale ids after redeploying or purging the database; passing an app-definition or case-definition id; using a definition from a different database schema than the one the command runs against.","solutions":["Verify the processDefinitionId exists via repositoryService.createProcessDefinitionQuery().processDefinitionId(id).singleResult() before calling the form lookup.","Confirm the deployment still contains its BPMN XML resource (check ACT_GE_BYTEARRAY / deployment resources); if purged, redeploy the process definition.","Ensure you are passing a process definition id, not a form/case/app definition id or task definition key.","Check that the command runs against the same engine/database that holds the definition."],"exampleFix":"// before\nList<FormDefinition> forms = formRepositoryService.getFormDefinitionsForProcessDefinition(processDefinitionId);\n// after\nProcessDefinition pd = repositoryService.createProcessDefinitionQuery()\n    .processDefinitionId(processDefinitionId).singleResult();\nif (pd == null) {\n    throw new IllegalArgumentException(\"Unknown process definition: \" + processDefinitionId);\n}\nList<FormDefinition> forms = formRepositoryService.getFormDefinitionsForProcessDefinition(processDefinitionId);","handlingStrategy":"try-catch","validationCode":"ProcessDefinition pd = repositoryService.createProcessDefinitionQuery()\n    .processDefinitionId(processDefinitionId).singleResult();\nif (pd == null) { throw new IllegalArgumentException(\"Unknown process definition: \" + processDefinitionId); }","typeGuard":null,"tryCatchPattern":"try {\n    return formRepositoryService.getFormDefinitionsForProcessDefinition(processDefinitionId);\n} catch (FlowableObjectNotFoundException e) {\n    log.warn(\"No BPMN model for definition {}: {}\", processDefinitionId, e.getMessage());\n    return Collections.emptyList();\n}","preventionTips":["Resolve the definition via ProcessDefinitionQuery before form lookups","Never purge deployment resources of definitions still in use","Distinguish process/form/case definition id namespaces clearly"],"tags":["flowable","bpmn","not-found","form-definitions"],"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-14T11:17:12.474Z"}