{"record":{"id":"a327843d143f0d63","repo":"theonedev/onedev","slug":"not-eligible-for-multi-value-a32784","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/booleaninput/BooleanInput.java","lineNumber":47,"sourceCode":"\t\tbuffer.append(\"    @NotNull(message=\\\"May not be empty\\\")\\n\");\n\t\tinputSpec.appendMethods(buffer, index, \"Boolean\", 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 false;\n\t\t} else if (strings.size() == 1) {\n\t\t\tString string = strings.iterator().next();\n\t\t\tif (string.equalsIgnoreCase(\"true\") || string.equalsIgnoreCase(TextUtils.getDisplayValue(true)))\n\t\t\t\treturn true;\n\t\t\telse if (string.equalsIgnoreCase(\"false\") || string.equalsIgnoreCase(TextUtils.getDisplayValue(false)))\n\t\t\t\treturn false;\n\t\t\telse\n\t\t\t\tthrow new ValidationException(\"Invalid boolean value\");\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 Boolean)\n\t\t\treturn Lists.newArrayList(TextUtils.getDisplayValue((Boolean)value));\n\t\telse\n\t\t\treturn Lists.newArrayList(TextUtils.getDisplayValue(false));\n\t}\n\n}\n","sourceCodeStart":29,"sourceCodeEnd":59,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/buildspecmodel/inputspec/booleaninput/BooleanInput.java#L29-L59","documentation":"BooleanInput.convertToObject only accepts zero or one value: a single boolean string is parsed, an empty list yields null. Supplying more than one value throws 'Not eligible for multi-value' since the boolean input is single-valued.","triggerScenarios":"Calling BooleanInput.convertToObject(List<String>) with a list of size 2 or more, e.g. multiple checked boxes serialized as several values for one boolean input.","commonSituations":"A UI/form or automation script sends an array of values where the input is a single checkbox; a spec copied from a multi-value input; generic form submission code collecting all params into lists without collapsing single-choice ones.","solutions":["Provide at most one value string ('true'/'false') in the list.","Collapse multi-element lists to a single decision (e.g. all-true check or take first) before the call.","Fix the form/UI binding so single-value inputs submit one value."],"exampleFix":"// before\nObject value = BooleanInput.convertToObject(Lists.newArrayList(\"true\", \"false\"));\n\n// after\nObject value = BooleanInput.convertToObject(Lists.newArrayList(\"true\"));","handlingStrategy":"validation","validationCode":"boolean validBooleanInput(List<String> strings) {\n    return strings == null || strings.size() <= 1;\n}","typeGuard":null,"tryCatchPattern":"try {\n    Object flag = BooleanInput.convertToObject(values);\n} catch (ValidationException e) {\n    // boolean inputs are single-valued; collapse the list to one value\n}","preventionTips":["Ensure forms/scripts submit exactly one value for boolean inputs.","Collapse multi-element lists before calling convertToObject."],"tags":["validation","buildspec","boolean","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"}