theonedev/onedev · error · ValidationException

Not eligible for multi-value

Error message

Not eligible for multi-value

What it means

IterationChoiceInput converts input strings into iteration (sprint) references. After handling allowMultiple and empty cases, a single value is returned, but a set with more than one element falls through to throw ValidationException('Not eligible for multi-value').

Source

Thrown at server-core/src/main/java/io/onedev/server/buildspecmodel/inputspec/IterationChoiceInput.java:45

		buffer.append("    @IterationChoice\n");
		
		if (inputSpec.isAllowMultiple())
			inputSpec.appendMethods(buffer, index, "List<String>", null, null);
		else 
			inputSpec.appendMethods(buffer, index, "String", null, null);
		
		return buffer.toString();
	}

	public static Object convertToObject(InputSpec inputSpec, List<String> strings) {
		if (inputSpec.isAllowMultiple()) 
			return strings;
		else if (strings.size() == 0) 
			return null;
		else if (strings.size() == 1)
			return strings.iterator().next();
		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;
	}

	public static int getOrdinal(String fieldValue) {
		int ordinal = -1;
		Project project = Project.get();

View on GitHub (pinned to d44925c47c)

Solutions

  1. Select/submit exactly one iteration for this input.
  2. Set allowMultiple: true on the iteration choice input if multiple selections are intended.
  3. Clear leftover multi-value defaults in the job spec after switching allowMultiple off.
  4. Fix the automation script to pass a single iteration value.

Example fix

// before
values: ["Sprint 1", "Sprint 2"]
// after (if multi intended)
allowMultiple: true
values: ["Sprint 1", "Sprint 2"]
Defensive patterns

Strategy: validation

Validate before calling

// Ensure value count matches allowMultiple setting
if (!inputSpec.isAllowMultiple() && values != null && values.size() > 1) {
  throw new Error("Iteration input accepts only one value unless allowMultiple is true");
}

Try / catch

try {
    Object iteration = iterationChoiceInput.convertToObject(strings);
} catch (ValidationException e) {
    if (e.getMessage().contains("multi-value")) {
        // either reduce to one value or set allowMultiple: true
    }
}

Prevention

When it happens

Trigger: convertToObject called with a strings collection of size >1 on an iteration choice input that is not in allowMultiple mode.

Common situations: Selecting multiple iterations in a form where the input only allows one; scripted submission of an array of iteration names; input spec changed from allowMultiple: true to false while old multi-values persist.

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/1104a2f4089a1c7f. Report an issue: GitHub.