theonedev/onedev · error · ValidationException

Not eligible for multi-value

Error message

Not eligible for multi-value

What it means

FloatInput.convertToObject is a single-value converter: it accepts an empty list (null) or exactly one float string. When the list has two or more elements it throws ValidationException "Not eligible for multi-value" because a Float input cannot represent multiple numbers.

Source

Thrown at server-core/src/main/java/io/onedev/server/buildspecmodel/inputspec/floatinput/FloatInput.java:41

		inputSpec.appendCommonAnnotations(buffer, index);
		if (!inputSpec.isAllowEmpty())
			buffer.append("    @NotNull(message=\"May not be empty\")\n");
		inputSpec.appendMethods(buffer, index, "Float", 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 Float.valueOf(strings.iterator().next());
			} catch (NumberFormatException e) {
				throw new ValidationException("Invalid float value");
			}
		} else {
			throw new ValidationException("Not eligible for multi-value");
		}
	}

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

}

View on GitHub (pinned to d44925c47c)

Solutions

  1. Submit only one value for the float input, or mark the input 'multiple: true' if multiple values are genuinely required.
  2. Check the build spec definition and align the converter used with the input's multiplicity.
  3. Guard the list size before calling convertToObject and surface a clear user-facing message.
  4. Split or flatten the value list at the caller so each FloatInput receives a single element.

Example fix

// before
Object f = FloatInput.convertToObject(Lists.newArrayList("1.0", "2.0")); // throws

// after
List<String> vs = Lists.newArrayList("1.0", "2.0");
if (vs.size() > 1)
    throw new ValidationException("Float input accepts a single value");
Object f = FloatInput.convertToObject(vs.subList(0, 1));
Defensive patterns

Strategy: validation

Validate before calling

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

Try / catch

try {
    f = FloatInput.convertToObject(values);
} catch (ValidationException e) {
    // handle multi-value or invalid input per field definition
}

Prevention

When it happens

Trigger: Calling FloatInput.convertToObject(List<String>) with 2+ elements; this occurs when a multi-value form field or a list of values is bound to a FloatInput that is not configured as multiple.

Common situations: An input defined with 'multiple: true' in the spec is later processed by the single-value path; a form submits repeated values for one input name; a script passes several numbers joined into a 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/a1204c290a3a3327. Report an issue: GitHub.