{"record":{"id":"fa72281b23215b9b","repo":"flowable/flowable-engine","slug":"form-model-for-task","errorCode":null,"errorMessage":"Form model for task ","messagePattern":"Form model for task ","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetTaskFormModelCmd.java","lineNumber":137,"sourceCode":"\n        FormInfo formInfo = null;\n        if (ignoreVariables) {\n            FormRepositoryService formRepositoryService = CommandContextUtil.getFormRepositoryService();\n            formInfo = formRepositoryService.getFormModelByKeyAndParentDeploymentId(task.getFormKey(), parentDeploymentId,\n                    task.getTenantId(), processEngineConfiguration.isFallbackToDefaultTenant());\n\n        } else if (endTime != null) {\n            formInfo = formService.getFormInstanceModelByKeyAndParentDeploymentId(task.getFormKey(), parentDeploymentId,\n                    taskId, task.getProcessInstanceId(), variables, task.getTenantId(), processEngineConfiguration.isFallbackToDefaultTenant());\n\n        } else {\n            formInfo = formService.getFormModelWithVariablesByKeyAndParentDeploymentId(task.getFormKey(), parentDeploymentId,\n                    taskId, variables, task.getTenantId(), processEngineConfiguration.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 task \" + task.getTaskDefinitionKey() + \" cannot be found for form key \" + task.getFormKey());\n        }\n\n        FormFieldHandler formFieldHandler = processEngineConfiguration.getFormFieldHandler();\n        formFieldHandler.enrichFormFields(formInfo);\n\n        return formInfo;\n    }\n\n}\n","sourceCodeStart":119,"sourceCodeEnd":147,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetTaskFormModelCmd.java#L119-L147","documentation":"FlowableObjectNotFoundException thrown by GetTaskFormModelCmd.execute when the task exists but no form model resolves from its formKey (and parent deploymentId/tenant). The comment notes it deliberately does not leak whether the task or only the form is missing. It indicates a form-definition/deployment mismatch rather than a bad task id.","triggerScenarios":"task.getFormKey() returns a key with no matching form definition deployed (formService.getFormModelWithVariablesByKeyAndParentDeploymentId returns null); the form was deployed to a different deployment/tenant than parentDeploymentId/tenantId; form definitions were deleted or not deployed for the process; fallback-to-default-tenant disabled and form lives in default tenant.","commonSituations":"Forgetting to deploy the .form file alongside the process definition; redeploying a new app version without the form resources; changing the formKey in the BPMN XML without deploying the renamed form; cross-tenant form lookups where isFallbackToDefaultTenant=false.","solutions":["Deploy a form definition whose key matches the task's formKey in the same app/deployment","Check the formKey in the BPMN <flowable:formKey> / task form property against deployed form keys (repositoryService query)","Ensure the form is deployed for the task's tenant (or enable processEngineConfiguration.isFallbackToDefaultTenant())","Verify parentDeploymentId resolution — deploy the form with the same deployment id as the process definition"],"exampleFix":"// before\n// BPMN: <userTask id=\"approve\" flowable:formKey=\"approvalForm\" /> but no form deployed\n// after: add src/main/resources/forms/approvalForm.form with key \"approvalForm\" to the deployment","handlingStrategy":"fallback","validationCode":"Task t = taskService.createTaskQuery().taskId(taskId).singleResult();\nboolean formDeployed = t != null && t.getFormKey() != null\n        && !repositoryService.createFormDefinitionQuery().formDefinitionKeyLike(t.getFormKey()).count()...; // or check deployed form keys","typeGuard":null,"tryCatchPattern":"try {\n    FormInfo form = taskService.getTaskFormModel(taskId);\n} catch (FlowableObjectNotFoundException e) {\n    renderDefaultForm(taskId); // graceful default UI instead of 500\n}","preventionTips":["Always deploy .form resources in the same app deployment as the BPMN files","Verify formKey values in the BPMN match deployed form keys after every model change","Enable fallback-to-default-tenant when forms are shared across tenants"],"tags":["flowable","form-not-found","deployment"],"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-18T11:17:12.947Z"}