flowable/flowable-engine · error · ActivitiIllegalArgumentException

Invalid value for enum form property

Error message

Invalid value for enum form property: ${value}

What it means

Thrown by EnumFormType.validateValue (invoked from both convertFormValueToModelValue and convertModelValueToFormValue) when a value for an enum form property is not null and is not a key of the configured 'values' map. The enum form type only accepts values explicitly listed in the form property definition (activiti:values in BPMN or the values map passed to the constructor).

Solutions

  1. Submit only values present in the form property's configured values map (check the BPMN activiti:values).
  2. Align case-sensitivity: enum keys are matched exactly, normalize input to the defined keys.
  3. Update the process model's enum values and redeploy when new options are needed, then refresh client-side lists.
  4. Validate user input against the form data via formService.getTaskFormData(taskId).getFormProperties() before submitting.

Example fix

// before
formProperties.put("priority", "urgent"); // not in enum values
// after
if (allowedValues.contains("critical")) {
    formProperties.put("priority", "critical");
}
Defensive patterns

Strategy: validation

Validate before calling

Map<String,String> allowed = enumFormType.getValues(); // or parse BPMN activiti:values
if (value != null && !allowed.containsKey(value)) {
    throw new IllegalArgumentException("Value not allowed: " + value + ", allowed: " + allowed.keySet());
}

Try / catch

try {
    formService.submitTaskFormData(taskId, props);
} catch (org.activiti.engine.ActivitiIllegalArgumentException e) {
    if (e.getMessage().startsWith("Invalid value for enum form property")) {
        props.put("priority", allowedKeys.stream().filter(k -> k.equalsIgnoreCase(submitted)).findFirst().orElse(null));
    }
}

Prevention

When it happens

Trigger: Submitting or rendering an enum form property with a value like "urgent" when the enum definition only contains keys such as low/normal/high; also hit when the values map is null and validation is skipped, vs present and missing the key.

Common situations: Client submits a stale value after the allowed enum set changed in a redeployed model; typos/case mismatches ('High' vs 'high'); values added in the UI but not in the BPMN form property definition.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/form/EnumFormType.java:67

        validateValue(propertyValue);
        return propertyValue;
    }

    @Override
    public String convertModelValueToFormValue(Object modelValue) {
        if (modelValue != null) {
            if (!(modelValue instanceof String)) {
                throw new ActivitiIllegalArgumentException("Model value should be a String");
            }
            validateValue((String) modelValue);
        }
        return (String) modelValue;
    }

    protected void validateValue(String value) {
        if (value != null) {
            if (values != null && !values.containsKey(value)) {
                throw new ActivitiIllegalArgumentException("Invalid value for enum form property: " + value);
            }
        }
    }

}

View on GitHub (pinned to d6d39ce1c6)