flowable/flowable-engine · error · FlowableIllegalArgumentException

This form type only support process definitions, but is " +…

Error message

This form type only support process definitions, but is " + modelValue.getClass()

What it means

ProcessDefinitionFormType converts a form value that must be a Flowable ProcessDefinition entity into its String id. The library throws FlowableIllegalArgumentException when the supplied model value is not null but also not a ProcessDefinition instance, because no meaningful form value can be derived from any other object type.

Solutions

  1. Pass an actual org.flowable.engine.repository.ProcessDefinition object, e.g. repositoryService.createProcessDefinitionQuery().processDefinitionId(id).singleResult().
  2. If you only have the id string, return the id directly instead of routing it through this form type.
  3. Null-check and type-check the value (instanceof ProcessDefinition) before calling convertModelValueToFormValue.
  4. Verify the form type registered for the variable is the intended one; use a String form type if the value is just an id.

Example fix

// before
String formValue = formType.convertModelValueToFormValue(processDefinitionId);
// after
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionId).singleResult();
String formValue = formType.convertModelValueToFormValue(pd);
Defensive patterns

Strategy: validation

Validate before calling

if (value == null || value instanceof ProcessDefinition) {
    formValue = formType.convertModelValueToFormValue(value);
}

Type guard

boolean isProcessDefinition(Object v) { return v instanceof org.flowable.engine.repository.ProcessDefinition; }

Try / catch

try { formValue = formType.convertModelValueToFormValue(value); } catch (FlowableIllegalArgumentException e) { /* wrong type supplied; log value class */ }

Prevention

When it happens

Trigger: Calling convertModelValueToFormValue(Object) with a non-null object that is not a ProcessDefinition — e.g. passing a String id, a Deployment, a ProcessDefinitionEntity from a different engine, or any arbitrary POJO as the form variable value.

Common situations: Developers set a form variable expecting the form type to accept the process definition id string, or accidentally pass the wrong variable (a deployment or model object) into a form property typed as process definition; also happens after refactoring when the variable type changed.

Understand the failure class

Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.

Related errors


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

Appendix: source

Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/form/ProcessDefinitionFormType.java:57

        if (propertyValue != null) {
            ProcessDefinition processDefinition = ProcessEngines.getDefaultProcessEngine().getRepositoryService().createProcessDefinitionQuery().processDefinitionId(propertyValue).singleResult();

            if (processDefinition == null) {
                throw new FlowableObjectNotFoundException("Process definition with id " + propertyValue + " does not exist", ProcessDefinitionEntity.class);
            }

            return processDefinition;
        }
        return null;
    }

    @Override
    public String convertModelValueToFormValue(Object modelValue) {
        if (modelValue == null) {
            return null;
        }
        if (!(modelValue instanceof ProcessDefinition)) {
            throw new FlowableIllegalArgumentException("This form type only support process definitions, but is " + modelValue.getClass());
        }
        return ((ProcessDefinition) modelValue).getId();
    }
}

View on GitHub (pinned to d6d39ce1c6)