theonedev/onedev · error · ValidationException

Not eligible for multi-value

Error message

Not eligible for multi-value

What it means

CommitInput supports exactly one value per input: after the null/empty case, convertToObject accepts strings.size()==1 and rejects anything larger with ValidationException('Not eligible for multi-value'), because commit inputs do not allow multiple selections.

Source

Thrown at server-core/src/main/java/io/onedev/server/buildspecmodel/inputspec/CommitInput.java:38

		buffer.append("    @CommitHash\n");
		if (!inputSpec.isAllowEmpty())
			buffer.append("    @NotEmpty\n");
		inputSpec.appendMethods(buffer, index, "String", null, null);
		
		return buffer.toString();
	}

	public static Object convertToObject(List<String> strings) {
		if (strings.size() == 0) {
			return null;
		} else if (strings.size() == 1) {
			String value = strings.iterator().next();
			if (ObjectId.isId(value))
				return value;
			else
				throw new ValidationException("Invalid commit id");
		} 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. Supply exactly one commit id for the input.
  2. Ensure the input is not rendered/used as multi-select (commit inputs do not support allowMultiple).
  3. If multiple commits are needed, split into several separate commit inputs.
  4. Fix the submitting script to pass a single scalar value instead of a collection.

Example fix

// before
values: ["abc123...", "def456..."]
// after
value: "abc123..."
Defensive patterns

Strategy: validation

Validate before calling

// Ensure single value before converting
if (values != null && values.size() > 1) {
  throw new Error("Commit input accepts exactly one value");
}

Try / catch

try {
    Object commit = CommitInput.convertToObject(strings);
} catch (ValidationException e) {
    if (e.getMessage().contains("multi-value")) {
        // reduce submitted list to a single element
    }
}

Prevention

When it happens

Trigger: convertToObject is called with a set/list of more than one string for a CommitInput, e.g. the input was submitted with multiple values selected or allowMultiple was set improperly upstream.

Common situations: Form submitted with a multi-select containing several commits; scripted parameter submission passing a list where a single value is expected; copying configuration from a multi-value choice input to a commit input.

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