theonedev/onedev · error · ValidationException

Not eligible for multi-value

Error message

Not eligible for multi-value

What it means

SecretInput.convertToObject converts a single-element string list into the secret's String value. Because a secret input holds exactly one value (or none), a list with more than one element triggers 'Not eligible for multi-value'.

Source

Thrown at server-core/src/main/java/io/onedev/server/buildspecmodel/inputspec/SecretInput.java:35

	public static String getPropertyDef(InputSpec inputSpec, Map<String, Integer> indexes) {
		int index = indexes.get(inputSpec.getName());
		StringBuffer buffer = new StringBuffer();
		inputSpec.appendField(buffer, index, "String");
		inputSpec.appendCommonAnnotations(buffer, index);
		buffer.append("    @NotEmpty\n");
		buffer.append("    @Password\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)
			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. Pass a list with at most one secret value string.
  2. If multiple secrets are needed, define multiple separate secret inputs instead of one.
  3. Inspect the source of the value list (UI binding or script) and ensure only one value is produced.

Example fix

// before
Object value = SecretInput.convertToObject(Lists.newArrayList("token1", "token2"));

// after
Object value = SecretInput.convertToObject(Lists.newArrayList("token1"));
Defensive patterns

Strategy: validation

Validate before calling

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

Try / catch

try {
    Object secret = SecretInput.convertToObject(values);
} catch (ValidationException e) {
    // secret inputs hold at most one value
}

Prevention

When it happens

Trigger: Calling SecretInput.convertToObject(List<String>) with a list containing two or more strings, e.g. a job/buildspec input bound to a secret that receives multiple values.

Common situations: Automation or a script passing several secret values or a joined/quoted list into a single secret input; form/UI changes sending multiple selections where the input is single-valued; misconfigured buildspec copy-pasted from a multi-value 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/5b2862ec104e8415. Report an issue: GitHub.