theonedev/onedev · error · ValidationException

Not eligible for multi-value

Error message

Not eligible for multi-value

What it means

TextInput.convertToObject is the single-value string converter: empty list becomes null, a one-element list returns that string. With two or more values it throws ValidationException "Not eligible for multi-value" because a text input is single-valued and cannot carry a list of strings.

Source

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

		if (!inputSpec.isAllowEmpty())
			buffer.append("    @NotEmpty\n");
		if (multiline)
			buffer.append("    @Multiline\n");
		buffer.append(MessageFormat.format("@Size(max={0}, message=\"Text is too long. Max {0} characters\")", String.valueOf(MAX_LEN)));
		if (pattern != null)
			buffer.append("    @Pattern(regexp=\"" + pattern + "\", message=\"Should match regular expression: " + pattern + "\")\n");
		inputSpec.appendMethods(buffer, index, "String", null, defaultValueProvider);

		return buffer.toString();
	}

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

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

View on GitHub (pinned to d44925c47c)

Solutions

  1. Submit only one string for the text input; remove duplicated parameters.
  2. If multiple lines/values are needed, use a textarea-style or multi-value input instead of single TextInput.
  3. Join intended multiple lines into one string (e.g. newline-separated) if that is the desired semantic.
  4. Validate the list size before calling convertToObject.

Example fix

// before
Object t = TextInput.convertToObject(Lists.newArrayList("a", "b")); // throws

// after
List<String> vs = Lists.newArrayList("a", "b");
Object t = vs.size() > 1
    ? TextInput.convertToObject(Lists.newArrayList(String.join("\n", vs)))
    : TextInput.convertToObject(vs);
Defensive patterns

Strategy: validation

Validate before calling

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

Try / catch

try {
    t = (String) TextInput.convertToObject(values);
} catch (ValidationException e) {
    // collapse or reject the multi-value submission
}

Prevention

When it happens

Trigger: Calling TextInput.convertToObject(List<String>) with 2+ strings; typically a form/API submits multiple values under one text input name, or a 'multiple: true' input is processed by the single-value path.

Common situations: Duplicated form fields or duplicated query/body parameters; a workflow previously defined as multi-select changed to a plain text input while old clients still send lists; scripts concatenating values into repeated parameters.

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