{"record":{"id":"f88ee6b7a37cc837","repo":"flowable/flowable-engine","slug":"form-model-for-process-definition","errorCode":null,"errorMessage":"Form model for process definition ","messagePattern":"Form model for process definition ","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetStartFormModelCmd.java","lineNumber":73,"sourceCode":"            throw new FlowableIllegalArgumentException(\"Form engine is not initialized\");\n        }\n\n        FormInfo formInfo = null;\n        ProcessDefinition processDefinition = ProcessDefinitionUtil.getProcessDefinition(processDefinitionId);\n        BpmnModel bpmnModel = ProcessDefinitionUtil.getBpmnModel(processDefinitionId);\n        Process process = bpmnModel.getProcessById(processDefinition.getKey());\n        FlowElement startElement = process.getInitialFlowElement();\n        if (startElement instanceof StartEvent startEvent) {\n            if (StringUtils.isNotEmpty(startEvent.getFormKey())) {\n                Deployment deployment = CommandContextUtil.getDeploymentEntityManager(commandContext).findById(processDefinition.getDeploymentId());\n                formInfo = formService.getFormInstanceModelByKeyAndParentDeploymentId(startEvent.getFormKey(), deployment.getParentDeploymentId(), \n                                null, processInstanceId, null, processDefinition.getTenantId(), processEngineConfiguration.isFallbackToDefaultTenant());\n            }\n        }\n\n        // If form does not exists, we don't want to leak out this info to just anyone\n        if (formInfo == null) {\n            throw new FlowableObjectNotFoundException(\"Form model for process definition \" + processDefinitionId + \" cannot be found\");\n        }\n\n        FormFieldHandler formFieldHandler = processEngineConfiguration.getFormFieldHandler();\n        formFieldHandler.enrichFormFields(formInfo);\n\n        return formInfo;\n    }\n\n}\n","sourceCodeStart":55,"sourceCodeEnd":83,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetStartFormModelCmd.java#L55-L83","documentation":"After resolving the process definition and its BPMN model, GetStartFormModelCmd looks up the form definition referenced by the start event; if formInfo remains null it throws FlowableObjectNotFoundException('Form model for process definition ... cannot be found'). The comment in the source makes the intent explicit: the start event declares a form that does not exist (or is not visible), and the engine refuses to leak that absence to arbitrary callers.","triggerScenarios":"getStartFormModel on a definition whose start event references a formKey/form definition that is not deployed in the form repository, or deployed under a different tenantId without fallback-to-default-tenant enabled.","commonSituations":"Deploying the process model without deploying the accompanying .form files; form definitions deployed to another tenant; form reference typo in flowable:formKey; querying before the form deployment transaction committed; multi-tenant setup where isFallbackToDefaultTenant is false and the tenant's form is missing.","solutions":["Deploy the form definitions (FormRepositoryService or the .form resources in the app deployment) so formKey resolves","Verify the formKey on the start event matches a deployed form info id/key and correct typos","In multi-tenant setups enable processEngineConfiguration.setFallbackToDefaultTenant(true) or deploy the form for the definition's tenant","Query formRepositoryService.createFormInfoQuery() (or form definition query) directly first to confirm the form exists for that tenant before calling the API"],"exampleFix":"// before\nformService.getStartFormModel(processDefinitionId, null); // throws if form not deployed\n// after\nFormInfo info = formRepositoryService.createFormDefinitionQuery()\n        .formDefinitionKey(\"myStartForm\").tenantId(tenantId).latestVersion().singleResult();\nif (info != null) {\n    formService.getStartFormModel(processDefinitionId, null);\n}","handlingStrategy":"validation","validationCode":"FormDefinition formDef = formRepositoryService.createFormDefinitionQuery()\n        .latestVersion()\n        .formDefinitionKey(startEventFormKey)\n        .tenantId(tenantId)\n        .singleResult();\nif (formDef == null) throw new IllegalStateException(\"Form \" + startEventFormKey + \" not deployed for tenant \" + tenantId);","typeGuard":"boolean startFormDeployed(FormRepositoryService frs, String formKey, String tenantId) {\n    return formKey != null && frs.createFormDefinitionQuery()\n        .formDefinitionKey(formKey)\n        .tenantId(tenantId)\n        .latestVersion()\n        .count() > 0;\n}","tryCatchPattern":"try {\n    return formService.getStartFormModel(pdId, null);\n} catch (FlowableObjectNotFoundException e) {\n    log.warn(\"Start form for {} not found (tenant deployment or formKey typo)\", pdId);\n    return null;\n}","preventionTips":["Deploy .form resources together with the process application deployment","Verify start-event formKey values match deployed form keys exactly (case-sensitive)","In multi-tenant installations, deploy forms per tenant or enable fallbackToDefaultTenant","Only query start forms after the deployment transaction has committed"],"tags":["flowable","form-definition","not-found"],"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-14T05:17:10.506Z"}