{"record":{"id":"af12c260216d1fd5","repo":"flowable/flowable-engine","slug":"cannot-find-process-definition-for-id-processde-af12c2","errorCode":null,"errorMessage":"Cannot find process definition for id: ${processDefinitionId}","messagePattern":"Cannot find process definition for id: (.+?)","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetFormDefinitionsForProcessDefinitionCmd.java","lineNumber":56,"sourceCode":"/**\n * @author Yvo Swillens\n */\npublic class GetFormDefinitionsForProcessDefinitionCmd implements Command<List<FormDefinition>>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n    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","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetFormDefinitionsForProcessDefinitionCmd.java#L38-L74","documentation":"Flowable throws FlowableObjectNotFoundException when ProcessDefinitionUtil.getProcessDefinition cannot resolve the given processDefinitionId in GetFormDefinitionsForProcessDefinitionCmd. The id doesn't correspond to a deployed process definition, so form definitions cannot be derived. Message: 'Cannot find process definition for id: <id>'.","triggerScenarios":"RepositoryService.getFormDefinitionsForProcessDefinition(badId); querying with an id from an undeployed/removed deployment; using a process definition KEY where an ID is required (or vice versa).","commonSituations":"Deployments cleaned up (database cleanup jobs) while clients cache old ids; mixing definition key vs id vs version-specific id; multi-tenant setup where the id belongs to another tenant; schema mismatch between environments.","solutions":["Verify the id via RepositoryService#createProcessDefinitionQuery#processDefinitionId before calling","If you have the key instead, resolve the latest definition id first (processDefinitionQuery.processDefinitionKey(...).latestVersion())","Redeploy the process definition if it was removed","Confirm tenant/engine targeting matches where the definition was deployed"],"exampleFix":"// before\nList<FormDefinition> forms = repositoryService.getFormDefinitionsForProcessDefinition(idOrKey);\n// after\nProcessDefinition pd = repositoryService.createProcessDefinitionQuery()\n    .processDefinitionId(idOrKey).singleResult();\nif (pd == null) {\n    pd = repositoryService.createProcessDefinitionQuery()\n        .processDefinitionKey(idOrKey).latestVersion().singleResult();\n}\nList<FormDefinition> forms = (pd != null)\n    ? repositoryService.getFormDefinitionsForProcessDefinition(pd.getId())\n    : Collections.emptyList();","handlingStrategy":"try-catch","validationCode":"ProcessDefinition pd = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionId).singleResult();\nif (pd == null) throw new IllegalStateException(\"Unknown process definition: \" + processDefinitionId);","typeGuard":null,"tryCatchPattern":"try { ... } catch (FlowableObjectNotFoundException e) { /* definition missing — redeploy or resolve by key */ }","preventionTips":["Distinguish definition keys from ids","Cache ids with deployment-aware invalidation","Verify tenant-scoped deployments match query tenant"],"tags":["flowable","entity-not-found","process-definition"],"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"}