{"record":{"id":"e99b09899da0b7a5","repo":"flowable/flowable-engine","slug":"form-model-for-case-definition-casedefinitionid","errorCode":null,"errorMessage":"Form model for case definition ${caseDefinitionId} cannot be found","messagePattern":"Form model for case definition (.+?) cannot be found","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetStartFormModelCmd.java","lineNumber":72,"sourceCode":"        if (formService == null) {\n            throw new FlowableIllegalArgumentException(\"Form engine is not initialized\");\n        }\n\n        FormInfo formInfo = null;\n        CaseDefinition caseDefinition = CaseDefinitionUtil.getCaseDefinition(caseDefinitionId);\n        CmmnModel cmmnModel = CaseDefinitionUtil.getCmmnModel(caseDefinitionId);\n        Case caseModel = cmmnModel.getCaseById(caseDefinition.getKey());\n        Stage planModel = caseModel.getPlanModel();\n\n        if (StringUtils.isNotEmpty(planModel.getFormKey())) {\n            CmmnDeployment deployment = CommandContextUtil.getCmmnDeploymentEntityManager(commandContext).findById(caseDefinition.getDeploymentId());\n            formInfo = formService.getFormInstanceModelByKeyAndParentDeploymentIdAndScopeId(planModel.getFormKey(), deployment.getParentDeploymentId(), \n                            caseInstanceId, ScopeTypes.CMMN, null, caseDefinition.getTenantId(), cmmnEngineConfiguration.isFallbackToDefaultTenant());\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 case definition \" + caseDefinitionId + \" cannot be found\");\n        }\n\n        FormFieldHandler formFieldHandler = cmmnEngineConfiguration.getFormFieldHandler();\n        formFieldHandler.enrichFormFields(formInfo);\n\n        return formInfo;\n    }\n}\n","sourceCodeStart":54,"sourceCodeEnd":81,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetStartFormModelCmd.java#L54-L81","documentation":"GetStartFormModelCmd throws FlowableObjectNotFoundException when the resolved FormInfo is null after querying the form repository. Per the source comment this is deliberate: it avoids leaking which form/definition exists to unauthorized callers.","triggerScenarios":"Calling getStartFormModel for a case definition whose start form key cannot be found (form not deployed, wrong form key in the model, form deployed under a different parent deployment/tenant), or the authenticated user is not authorized for the form instance scope.","commonSituations":"Redeploying a case model without its associated .form files; formKey in the CMMN XML not matching the deployed form's key; multi-tenant deployment where the form lives in another tenant; querying with a caseInstanceId whose scope has no form instance yet.","solutions":["Deploy the form definition referenced by the case model's start form key in the same app/deployment","Confirm the formKey in the Case element matches the deployed form's key and tenant","Check tenantId/parentDeploymentId handling — enable fallbackToDefaultTenant if forms live in the default tenant","Verify the caller is authorized (the null result intentionally hides existence from unauthorized users)"],"exampleFix":"// before\nFormInfo info = cmmnRuntimeService.getStartFormModel(caseDefId, caseInstanceId); // throws if form missing\n// after\nFormInfo info = cmmnRuntimeService.getStartFormModel(caseDefId, caseInstanceId);\nif (info == null) { /* unreachable: API throws */ }\n// deployment side: ensure myStartForm.form is part of the same deployment archive as the case model","handlingStrategy":"try-catch","validationCode":"// Verify the start form is deployed for this case definition's key/tenant\nFormDefinition f = formRepositoryService.createFormDefinitionQuery()\n    .latestVersion()\n    .formKey(expectedFormKey)\n    .tenantId(tenantId).singleResult();","typeGuard":null,"tryCatchPattern":"try {\n    FormInfo info = cmmnRuntimeService.getStartFormModel(caseDefId, caseInstanceId);\n} catch (FlowableObjectNotFoundException e) {\n    // treat as 404: form not deployed or user not authorized; do not distinguish\n}","preventionTips":["Deploy .form files in the same archive as the case model","Keep formKey values in CMMN XML in sync with deployed form keys","Check tenant and parentDeploymentId alignment; enable fallbackToDefaultTenant when appropriate"],"tags":["cmmn","forms","not-found"],"backgroundTag":"form-definition-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"}