theonedev/onedev · error · ValidationException
Not eligible for multi-value
Error message
Not eligible for multi-value
What it means
PullRequestChoiceInput.convertToObject accepts at most one value; it converts a single string to a Long pull request id/number. When the input list contains more than one element it throws 'Not eligible for multi-value', because this input type is defined as single-choice.
Source
Thrown at server-core/src/main/java/io/onedev/server/buildspecmodel/inputspec/PullRequestChoiceInput.java:37
buffer.append(" @NotNull\n");
buffer.append(" @PullRequestChoice(useNumber=true)\n");
inputSpec.appendMethods(buffer, index, "Long", null, null);
return buffer.toString();
}
public static Object convertToObject(List<String> strings) {
if (strings.size() == 0) {
return null;
} else if (strings.size() == 1) {
String value = strings.iterator().next();
try {
return Long.valueOf(value);
} catch (NumberFormatException e) {
throw new ValidationException("Invalid pull request id/number");
}
} else {
throw new ValidationException("Not eligible for multi-value");
}
}
public static List<String> convertToStrings(Object value) {
if (value instanceof Long)
return Lists.newArrayList(value.toString());
else
return new ArrayList<>();
}
}
View on GitHub (pinned to d44925c47c)
Solutions
- Supply exactly one pull request id/number string in the list.
- If multiple values are truly needed, enable multi-value on the input definition instead of passing a list.
- Split or reduce upstream data (e.g. take the first or reject extra values) before calling convertToObject.
Example fix
// before
List<String> vals = Lists.newArrayList("12", "15");
Object value = PullRequestChoiceInput.convertToObject(vals); // throws
// after
List<String> vals = Lists.newArrayList("12");
Object value = PullRequestChoiceInput.convertToObject(vals); Defensive patterns
Strategy: validation
Validate before calling
boolean singleValue(List<String> strings) {
return strings != null && strings.size() <= 1;
} Try / catch
try {
Object pr = PullRequestChoiceInput.convertToObject(values);
} catch (ValidationException e) {
// input is single-choice; reduce values to one element
} Prevention
- Remember pull-request choice inputs are single-valued; enable multi-value on the input if lists are expected.
- Collapse or reject multi-element lists upstream before conversion.
When it happens
Trigger: Calling PullRequestChoiceInput.convertToObject with a List<String> of size > 1, e.g. multiple selected pull requests supplied where only one is allowed.
Common situations: A buildspec or job input marked as a pull-request choice (single value) is fed a comma-separated or multi-selected list from a script or automation; a UI/form change started sending multiple values without switching the input to multi-value mode.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Not eligible for multi-value
- Not eligible for multi-value
- Not eligible for multi-value
- Not eligible for multi-value
- Circular template usages (
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/4893ab1e4d6397df.
Report an issue: GitHub.