flowable/flowable-engine · error · FlowableObjectNotFoundException

Form model for task cannot be found for form key

Error message

Form model for task ${task.getTaskDefinitionKey()} cannot be found for form key ${task.getFormKey()}

What it means

GetTaskFormModelCmd throws FlowableObjectNotFoundException when the form repository returns null FormInfo for the task's form key. The message intentionally omits existence details ('we don't want to leak out this info'), covering both missing forms and unauthorized access.

Solutions

  1. Deploy the .form definition whose key matches the task's formKey in the same deployment as the case model
  2. Verify task.getFormKey() against deployed form keys in the form repository
  3. Check tenant/parentDeploymentId resolution — enable fallbackToDefaultTenant in the engine config if forms are in the default tenant
  4. Redeploy both the case model and forms together to keep keys and deployments in sync

Example fix

// before
FormInfo info = cmmnTaskService.getTaskFormModel(taskId); // throws when form key unresolvable
// after
FormInfo info = null;
try { info = cmmnTaskService.getTaskFormModel(taskId); }
catch (FlowableObjectNotFoundException e) {
    // redeploy missing form for task definition key 'approveTask' with key matching the task's formKey
}
Defensive patterns

Strategy: try-catch

Validate before calling

FormDefinition f = formRepositoryService.createFormDefinitionQuery()
    .formKey(task.getFormKey())
    .tenantId(task.getTenantId())
    .singleResult();
if (f == null) {
    throw new IllegalStateException("Form not deployed for key " + task.getFormKey());
}

Try / catch

try {
    FormInfo info = cmmnTaskService.getTaskFormModel(taskId);
} catch (FlowableObjectNotFoundException e) {
    // form missing or unauthorized; log taskDefinitionKey + formKey and redeploy form
}

Prevention

When it happens

Trigger: Task's formKey has no deployed matching form (form not deployed, key mismatch, wrong parent deployment id), or the form instance cannot be resolved for the task's scope/tenant.

Common situations: Case/task models deployed without accompanying .form resources; formKey changed in the model after deployment; multi-tenant setups where forms deploy under a different tenant than the task; form deleted after deployment.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/7145681365efd115. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetTaskFormModelCmd.java:118

        FormInfo formInfo = null;
        if (ignoreVariables) {
            FormRepositoryService formRepositoryService = CommandContextUtil.getFormRepositoryService();
            formInfo = formRepositoryService.getFormModelByKeyAndParentDeploymentId(task.getFormKey(), parentDeploymentId, 
                            task.getTenantId(), cmmnEngineConfiguration.isFallbackToDefaultTenant());
            
        } else if (endTime != null) {
            formInfo = formService.getFormInstanceModelByKeyAndParentDeploymentIdAndScopeId(task.getFormKey(), parentDeploymentId, task.getScopeId(), 
                            task.getScopeType(), variables, task.getTenantId(), cmmnEngineConfiguration.isFallbackToDefaultTenant());

        } else {
            formInfo = formService.getFormModelWithVariablesByKeyAndParentDeploymentId(task.getFormKey(), parentDeploymentId,
                            taskId, variables, task.getTenantId(), cmmnEngineConfiguration.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 = cmmnEngineConfiguration.getFormFieldHandler();
        formFieldHandler.enrichFormFields(formInfo);

        return formInfo;
    }

}

View on GitHub (pinned to d6d39ce1c6)