{"record":{"id":"3608157518ec63e5","repo":"flowable/flowable-engine","slug":"invalid-value-for-enum-form-property-value","errorCode":null,"errorMessage":"Invalid value for enum form property: + value","messagePattern":"Invalid value for enum form property: \\+ value","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/form/EnumFormType.java","lineNumber":67,"sourceCode":"        validateValue(propertyValue);\n        return propertyValue;\n    }\n\n    @Override\n    public String convertModelValueToFormValue(Object modelValue) {\n        if (modelValue != null) {\n            if (!(modelValue instanceof String)) {\n                throw new FlowableIllegalArgumentException(\"Model value should be a String\");\n            }\n            validateValue((String) modelValue);\n        }\n        return (String) modelValue;\n    }\n\n    protected void validateValue(String value) {\n        if (value != null) {\n            if (values != null && !values.containsKey(value)) {\n                throw new FlowableIllegalArgumentException(\"Invalid value for enum form property: \" + value);\n            }\n        }\n    }\n\n}\n","sourceCodeStart":49,"sourceCodeEnd":73,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/form/EnumFormType.java#L49-L73","documentation":"EnumFormType.validateValue checks a submitted or stored enum form value against the configured 'values' map (the <flowable:value> entries in the BPMN). If the value is not among them, FlowableIllegalArgumentException 'Invalid value for enum form property: <value>' is thrown. It enforces that only declared enum options are accepted.","triggerScenarios":"FormService.submitTaskFormData/startProcessInstanceByForm with a property value not present in the enum's configured values, or setting the variable to an undocumented String which is then converted.","commonSituations":"BPMN form values updated (renamed options) while clients/old UI still submit old keys, case-sensitivity mismatches ('High' vs 'high'), values defined in one form property but reused with a different set elsewhere.","solutions":["Submit one of the exact values declared via flowable:value entries in the BPMN form property.","Align client-side dropdown options with the current BPMN values after a redeploy.","Check case-sensitivity and trim whitespace on the submitted value.","If dynamic options are needed, replace the enum form type with a custom FormType or store options as variables instead of form metadata."],"exampleFix":"// before\nproperties.put(\"priority\", \"urgent\"); // BPMN only defines low|medium|high\n// after\nproperties.put(\"priority\", \"high\"); // must match a flowable:value entry","handlingStrategy":"validation","validationCode":"Map<String,String> allowed = formService.getTaskFormData(taskId).getFormProperties().stream()\n    .filter(p -> p.getId().equals(enumField))\n    .map(FormProperty::getType)\n    .filter(EnumFormType.class::isInstance)\n    .map(p -> ((EnumFormType) p).getValues().keySet())\n    .findFirst().orElse(Set.of());\nif (!allowed.contains(submittedValue)) {\n    throw new IllegalArgumentException(\"Allowed enum values: \" + allowed);\n}","typeGuard":null,"tryCatchPattern":"try {\n    formService.submitTaskFormData(taskId, properties);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Invalid value for enum form property\")) {\n        refreshAllowedEnumOptions(); // reload form metadata and retry with mapped value\n    } else { throw e; }\n}","preventionTips":["Populate UI dropdowns from the form metadata, not hardcoded lists.","Re-fetch form options after every BPMN redeploy.","Compare submitted values case-sensitively and trim whitespace.","Keep enum option sets identical wherever the same property id is reused."],"tags":["flowable","forms","enum","validation"],"backgroundTag":"invalid-enum-value","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"}