theonedev/onedev · error · ValidationException

Not eligible for multi-value

Error message

Not eligible for multi-value

What it means

BooleanInput.convertToObject only accepts zero or one value: a single boolean string is parsed, an empty list yields null. Supplying more than one value throws 'Not eligible for multi-value' since the boolean input is single-valued.

Source

Thrown at server-core/src/main/java/io/onedev/server/buildspecmodel/inputspec/booleaninput/BooleanInput.java:47

		buffer.append("    @NotNull(message=\"May not be empty\")\n");
		inputSpec.appendMethods(buffer, index, "Boolean", null, defaultValueProvider);
		
		return buffer.toString();
	}

	public static Object convertToObject(List<String> strings) {
		if (strings.size() == 0) {
			return false;
		} else if (strings.size() == 1) {
			String string = strings.iterator().next();
			if (string.equalsIgnoreCase("true") || string.equalsIgnoreCase(TextUtils.getDisplayValue(true)))
				return true;
			else if (string.equalsIgnoreCase("false") || string.equalsIgnoreCase(TextUtils.getDisplayValue(false)))
				return false;
			else
				throw new ValidationException("Invalid boolean value");
		} else {
			throw new ValidationException("Not eligible for multi-value");
		}
	}

	public static List<String> convertToStrings(Object value) {
		if (value instanceof Boolean)
			return Lists.newArrayList(TextUtils.getDisplayValue((Boolean)value));
		else
			return Lists.newArrayList(TextUtils.getDisplayValue(false));
	}

}

View on GitHub (pinned to d44925c47c)

Solutions

  1. Provide at most one value string ('true'/'false') in the list.
  2. Collapse multi-element lists to a single decision (e.g. all-true check or take first) before the call.
  3. Fix the form/UI binding so single-value inputs submit one value.

Example fix

// before
Object value = BooleanInput.convertToObject(Lists.newArrayList("true", "false"));

// after
Object value = BooleanInput.convertToObject(Lists.newArrayList("true"));
Defensive patterns

Strategy: validation

Validate before calling

boolean validBooleanInput(List<String> strings) {
    return strings == null || strings.size() <= 1;
}

Try / catch

try {
    Object flag = BooleanInput.convertToObject(values);
} catch (ValidationException e) {
    // boolean inputs are single-valued; collapse the list to one value
}

Prevention

When it happens

Trigger: Calling BooleanInput.convertToObject(List<String>) with a list of size 2 or more, e.g. multiple checked boxes serialized as several values for one boolean input.

Common situations: A UI/form or automation script sends an array of values where the input is a single checkbox; a spec copied from a multi-value input; generic form submission code collecting all params into lists without collapsing single-choice ones.

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