flowable/flowable-engine · error · FlowableObjectNotFoundException
Form model for task
Error message
Form model for task
What it means
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.
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
Example fix
// before // BPMN: <userTask id="approve" flowable:formKey="approvalForm" /> but no form deployed // after: add src/main/resources/forms/approvalForm.form with key "approvalForm" to the deployment
Defensive patterns
Strategy: fallback
Validate before calling
Task t = taskService.createTaskQuery().taskId(taskId).singleResult();
boolean formDeployed = t != null && t.getFormKey() != null
&& !repositoryService.createFormDefinitionQuery().formDefinitionKeyLike(t.getFormKey()).count()...; // or check deployed form keys Try / catch
try {
FormInfo form = taskService.getTaskFormModel(taskId);
} catch (FlowableObjectNotFoundException e) {
renderDefaultForm(taskId); // graceful default UI instead of 500
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- byte array for resource
- byte array for resource
- byte array for resource
- bytes array is null
- bytes is null
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/fa72281b23215b9b.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetTaskFormModelCmd.java:137
FormInfo formInfo = null;
if (ignoreVariables) {
FormRepositoryService formRepositoryService = CommandContextUtil.getFormRepositoryService();
formInfo = formRepositoryService.getFormModelByKeyAndParentDeploymentId(task.getFormKey(), parentDeploymentId,
task.getTenantId(), processEngineConfiguration.isFallbackToDefaultTenant());
} else if (endTime != null) {
formInfo = formService.getFormInstanceModelByKeyAndParentDeploymentId(task.getFormKey(), parentDeploymentId,
taskId, task.getProcessInstanceId(), variables, task.getTenantId(), processEngineConfiguration.isFallbackToDefaultTenant());
} else {
formInfo = formService.getFormModelWithVariablesByKeyAndParentDeploymentId(task.getFormKey(), parentDeploymentId,
taskId, variables, task.getTenantId(), processEngineConfiguration.isFallbackToDefaultTenant());
}
// If form does not exists, we don't want to leak out this info to just anyone
if (formInfo == null) {
throw new FlowableObjectNotFoundException("Form model for task " + task.getTaskDefinitionKey() + " cannot be found for form key " + task.getFormKey());
}
FormFieldHandler formFieldHandler = processEngineConfiguration.getFormFieldHandler();
formFieldHandler.enrichFormFields(formInfo);
return formInfo;
}
}
View on GitHub (pinned to d6d39ce1c6)