{"record":{"id":"5b440d7501ac4364","repo":"theonedev/onedev","slug":"not-eligible-for-multi-value","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/CommitInput.java","lineNumber":38,"sourceCode":"\t\tbuffer.append(\"    @CommitHash\\n\");\n\t\tif (!inputSpec.isAllowEmpty())\n\t\t\tbuffer.append(\"    @NotEmpty\\n\");\n\t\tinputSpec.appendMethods(buffer, index, \"String\", 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\tif (ObjectId.isId(value))\n\t\t\t\treturn value;\n\t\t\telse\n\t\t\t\tthrow new ValidationException(\"Invalid commit id\");\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 String)\n\t\t\treturn Lists.newArrayList((String) value);\n\t\telse\n\t\t\treturn new ArrayList<>();\n\t}\n\t\n}\n","sourceCodeStart":20,"sourceCodeEnd":50,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/buildspecmodel/inputspec/CommitInput.java#L20-L50","documentation":"CommitInput supports exactly one value per input: after the null/empty case, convertToObject accepts strings.size()==1 and rejects anything larger with ValidationException('Not eligible for multi-value'), because commit inputs do not allow multiple selections.","triggerScenarios":"convertToObject is called with a set/list of more than one string for a CommitInput, e.g. the input was submitted with multiple values selected or allowMultiple was set improperly upstream.","commonSituations":"Form submitted with a multi-select containing several commits; scripted parameter submission passing a list where a single value is expected; copying configuration from a multi-value choice input to a commit input.","solutions":["Supply exactly one commit id for the input.","Ensure the input is not rendered/used as multi-select (commit inputs do not support allowMultiple).","If multiple commits are needed, split into several separate commit inputs.","Fix the submitting script to pass a single scalar value instead of a collection."],"exampleFix":"// before\nvalues: [\"abc123...\", \"def456...\"]\n// after\nvalue: \"abc123...\"","handlingStrategy":"validation","validationCode":"// Ensure single value before converting\nif (values != null && values.size() > 1) {\n  throw new Error(\"Commit input accepts exactly one value\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    Object commit = CommitInput.convertToObject(strings);\n} catch (ValidationException e) {\n    if (e.getMessage().contains(\"multi-value\")) {\n        // reduce submitted list to a single element\n    }\n}","preventionTips":["Render commit inputs as single-select only.","Do not copy multi-select config onto commit inputs.","Submit scalars, not arrays, from automation scripts."],"tags":["validation","input","multi-value","commit"],"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"}