theonedev/onedev · error · ValidationException

Not eligible for multi-value

Error message

Not eligible for multi-value

What it means

IntegerInput.convertToObject is a single-value converter: empty list gives null, exactly one integer string is parsed. With two or more values it throws ValidationException "Not eligible for multi-value" because an Integer input can hold only one number.

Source

Thrown at server-core/src/main/java/io/onedev/server/buildspecmodel/inputspec/integerinput/IntegerInput.java:50

		} else if (maxValue != null) {
			buffer.append("    @Range(max=" + maxValue.toString() + "L)\n");
		}
		inputSpec.appendMethods(buffer, index, "Integer", null, defaultValueProvider);
		
		return buffer.toString();
	}

	public static Object convertToObject(List<String> strings) {
		if (strings.size() == 0) { 
			return null;
		} else if (strings.size() == 1) {
			try {
				return Integer.valueOf(strings.iterator().next());
			} catch (NumberFormatException e) {
				throw new ValidationException("Invalid integer value");
			}
		} else {
			throw new ValidationException("Not eligible for multi-value");
		}
	}

	public static List<String> convertToStrings(Object value) {
		if (value instanceof Integer)
			return Lists.newArrayList(String.valueOf(value));
		else
			return new ArrayList<>();
	}

}

View on GitHub (pinned to d44925c47c)

Solutions

  1. Submit exactly one value, or configure the input as multiple if a list of integers is intended.
  2. Deduplicate repeated request parameters before conversion.
  3. Check list size before calling convertToObject and reject multi-value input with a clear message.
  4. Use an appropriate multi-value input type instead of IntegerInput for list semantics.

Example fix

// before
Object i = IntegerInput.convertToObject(Lists.newArrayList("1", "2")); // throws

// after
List<String> vs = Lists.newArrayList("1", "2");
if (vs.size() > 1)
    throw new ValidationException("Integer input accepts a single value");
Object i = IntegerInput.convertToObject(vs.subList(0, 1));
Defensive patterns

Strategy: validation

Validate before calling

if (values != null && values.size() > 1)
    throw new ValidationException("Integer input accepts a single value");

Try / catch

try {
    i = IntegerInput.convertToObject(values);
} catch (ValidationException e) {
    // handle multi-value or invalid input
}

Prevention

When it happens

Trigger: Calling IntegerInput.convertToObject(List<String>) with 2+ elements; a multi-value form field or repeated parameter is routed to a non-multiple IntegerInput.

Common situations: Input declared 'multiple: true' in the spec but consumed by single-value conversion code; duplicated HTML form fields sharing the same name; a script appends several numbers to the submitted list.

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


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/35927d0eff59edd2. Report an issue: GitHub.