theonedev/onedev · error · ValidationException
Not eligible for multi-value
Error message
Not eligible for multi-value
What it means
ChoiceInput.convertToObject rejects collections with more than one value for single-choice inputs. If the input spec has allowMultiple==false and the submitted strings collection has more than one entry, a ValidationException is thrown. A single-choice input accepts zero or one value only.
Source
Thrown at server-core/src/main/java/io/onedev/server/buildspecmodel/inputspec/choiceinput/ChoiceInput.java:77
return strings;
} else {
return strings;
}
} else if (strings.size() == 0) {
return null;
} else if (strings.size() == 1) {
String value = strings.iterator().next();
List<String> possibleValues = inputSpec.getPossibleValues();
if (!possibleValues.isEmpty()) {
if (!possibleValues.contains(value))
throw new ValidationException("Invalid choice value");
else
return value;
} else {
return value;
}
} else {
throw new ValidationException("Not eligible for multi-value");
}
}
@SuppressWarnings("unchecked")
public static List<String> convertToStrings(InputSpec inputSpec, Object value) {
List<String> strings = new ArrayList<>();
if (inputSpec.isAllowMultiple()) {
if (inputSpec.checkListElements(value, String.class))
strings.addAll((List<String>) value);
Collections.sort(strings);
} else if (value instanceof String) {
strings.add((String) value);
}
return strings;
}
}
View on GitHub (pinned to d44925c47c)
Solutions
- Set allowMultiple: true on the input if multiple selections are legitimate.
- Reduce the submitted collection to a single value matching the single-choice semantics.
- Clean up stored job parameters that accumulated multiple values from a previous multi-value configuration.
- Check upstream form/serialization logic that duplicates values.
Example fix
// before (spec) environment: type: choice allowMultiple: false value: [dev, staging] // after allowMultiple: true
Defensive patterns
Strategy: validation
Validate before calling
if (!inputSpec.isAllowMultiple() && strings.size() > 1)
throw new IllegalArgumentException("Input '" + inputSpec.getName() + "' accepts at most one value"); Type guard
boolean isSingleValue(Collection<String> strings, InputSpec spec) {
return spec.isAllowMultiple() || strings.size() <= 1;
} Try / catch
try {
Object result = ChoiceInput.convertToObject(inputSpec, strings);
} catch (ValidationException e) {
logger.warn("Multi-value submitted to single-choice input: {}", strings);
// take first value or reject with user feedback
} Prevention
- Match collection cardinality to the input's allowMultiple setting.
- When changing allowMultiple in a spec, clean up previously stored parameter values.
- Only send single-element collections for scalar inputs.
- Test form serialization so duplicate values are not silently collected.
When it happens
Trigger: Calling ChoiceInput.convertToObject on a ChoiceInput whose inputSpec.isAllowMultiple() returns false, with strings.size() > 1 (after the single-value and zero-value branches fall through to the else).
Common situations: A UI or script submits multiple selected values while the input is defined as single-choice; a build spec changed allowMultiple from true to false but existing stored parameters still contain multiple values; form serialization bug collecting duplicate values.
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/a9f444c0f750cacd.
Report an issue: GitHub.