{"record":{"id":"35927d0eff59edd2","repo":"theonedev/onedev","slug":"not-eligible-for-multi-value-35927d","errorCode":null,"errorMessage":"Not eligible for multi-value","messagePattern":"Not eligible for multi-value","errorType":"validation","errorClass":"ValidationException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/buildspecmodel/inputspec/integerinput/IntegerInput.java","lineNumber":50,"sourceCode":"\t\t} else if (maxValue != null) {\n\t\t\tbuffer.append(\"    @Range(max=\" + maxValue.toString() + \"L)\\n\");\n\t\t}\n\t\tinputSpec.appendMethods(buffer, index, \"Integer\", null, defaultValueProvider);\n\t\t\n\t\treturn buffer.toString();\n\t}\n\n\tpublic static Object convertToObject(List<String> strings) {\n\t\tif (strings.size() == 0) { \n\t\t\treturn null;\n\t\t} else if (strings.size() == 1) {\n\t\t\ttry {\n\t\t\t\treturn Integer.valueOf(strings.iterator().next());\n\t\t\t} catch (NumberFormatException e) {\n\t\t\t\tthrow new ValidationException(\"Invalid integer value\");\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new ValidationException(\"Not eligible for multi-value\");\n\t\t}\n\t}\n\n\tpublic static List<String> convertToStrings(Object value) {\n\t\tif (value instanceof Integer)\n\t\t\treturn Lists.newArrayList(String.valueOf(value));\n\t\telse\n\t\t\treturn new ArrayList<>();\n\t}\n\n}\n","sourceCodeStart":32,"sourceCodeEnd":62,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/buildspecmodel/inputspec/integerinput/IntegerInput.java#L32-L62","documentation":"IntegerInput.convertToObject is a single-value converter: empty list gives null, exactly one integer string is parsed. With two or more values it throws ValidationException \"Not eligible for multi-value\" because an Integer input can hold only one number.","triggerScenarios":"Calling IntegerInput.convertToObject(List<String>) with 2+ elements; a multi-value form field or repeated parameter is routed to a non-multiple IntegerInput.","commonSituations":"Input declared 'multiple: true' in the spec but consumed by single-value conversion code; duplicated HTML form fields sharing the same name; a script appends several numbers to the submitted list.","solutions":["Submit exactly one value, or configure the input as multiple if a list of integers is intended.","Deduplicate repeated request parameters before conversion.","Check list size before calling convertToObject and reject multi-value input with a clear message.","Use an appropriate multi-value input type instead of IntegerInput for list semantics."],"exampleFix":"// before\nObject i = IntegerInput.convertToObject(Lists.newArrayList(\"1\", \"2\")); // throws\n\n// after\nList<String> vs = Lists.newArrayList(\"1\", \"2\");\nif (vs.size() > 1)\n    throw new ValidationException(\"Integer input accepts a single value\");\nObject i = IntegerInput.convertToObject(vs.subList(0, 1));","handlingStrategy":"validation","validationCode":"if (values != null && values.size() > 1)\n    throw new ValidationException(\"Integer input accepts a single value\");","typeGuard":null,"tryCatchPattern":"try {\n    i = IntegerInput.convertToObject(values);\n} catch (ValidationException e) {\n    // handle multi-value or invalid input\n}","preventionTips":["Keep single-value integer inputs bound to single-value controls.","Use a multi-value input type when a list of numbers is required.","Cover converters with size 0/1/2 list tests."],"tags":["validation","input-spec","single-value","multi-value"],"backgroundTag":"invalid-argument-value","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}