{"record":{"id":"08f8d01b9daa554b","repo":"theonedev/onedev","slug":"not-eligible-for-multi-value-08f8d0","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/IssueChoiceInput.java","lineNumber":37,"sourceCode":"\t\t\tbuffer.append(\"    @NotNull\\n\");\n\t\tbuffer.append(\"    @IssueChoice(useNumber=true)\\n\");\n\t\tinputSpec.appendMethods(buffer, index, \"Long\", null, null);\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\tString value = strings.iterator().next();\n\t\t\ttry {\n\t\t\t\treturn Long.valueOf(value);\n\t\t\t} catch (NumberFormatException e) {\n\t\t\t\tthrow new ValidationException(\"Invalid issue id/number\");\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 Long)\n\t\t\treturn Lists.newArrayList(value.toString());\n\t\telse\n\t\t\treturn new ArrayList<>();\n\t}\n\n}\n","sourceCodeStart":19,"sourceCodeEnd":49,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/buildspecmodel/inputspec/IssueChoiceInput.java#L19-L49","documentation":"IssueChoiceInput accepts only one value per submission: the strings.size()==1 branch parses a single id, and any collection larger than one hits the else branch throwing ValidationException('Not eligible for multi-value').","triggerScenarios":"convertToObject called with more than one string for an issue-choice input, e.g. multiple values selected in the form or a list passed programmatically.","commonSituations":"Submitting a multi-value list from an automation script; input mistakenly configured/rendered as multi-select; reusing a multi-value parameter definition for an issue choice input.","solutions":["Pass exactly one issue id for this input.","Remove multiple selection in the form before submitting.","If several issues are needed, create separate issue-choice inputs.","Fix the script to submit a scalar value rather than an array."],"exampleFix":"// before\nvalues: [\"12\", \"34\"]\n// after\nvalue: \"12\"","handlingStrategy":"validation","validationCode":"// Ensure single value before converting\nif (values != null && values.size() > 1) {\n  throw new Error(\"Issue choice input accepts exactly one value\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    Object issue = IssueChoiceInput.convertToObject(strings);\n} catch (ValidationException e) {\n    if (e.getMessage().contains(\"multi-value\")) {\n        // take first element or ask user to select one\n    }\n}","preventionTips":["Keep issue choice inputs single-select.","Fix scripts that submit arrays of issue ids.","Separate inputs per issue when multiple are needed."],"tags":["validation","input","multi-value","issues"],"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-14T05:17:10.506Z"}