theonedev/onedev · error · ValidationException

Duplicate param (

Error message

Duplicate param (

What it means

Thrown during public ParamUtils.validateParamMatrix(List<Param>, List<ParamSpec>) when two Param entries share the same name; the HashMap.put returning non-null signals the duplicate. Each parameter in a buildspec must have a unique name since values are keyed by name.

Source

Thrown at server-core/src/main/java/io/onedev/server/buildspec/param/ParamUtils.java:134

	}
	
	public static Map<String, ParamSpec> getParamSpecMap(List<ParamSpec> paramSpecs) {
		Map<String, ParamSpec> paramSpecMap = new LinkedHashMap<>();
		for (ParamSpec paramSpec: paramSpecs)
			paramSpecMap.put(paramSpec.getName(), paramSpec);
		return paramSpecMap;
	}

	public static void validateParamMatrix(List<ParamSpec> paramSpecs, List<ParamInstances> paramMatrix) {
		Map<String, List<List<String>>> evaledParamMatrix = new HashMap<>();
		for (ParamInstances param: paramMatrix) {
			List<List<String>> values;
			if (param.getValuesProvider() instanceof SpecifiedValues specifiedValues)
				values = specifiedValues.getValues();
			else
				values = null;
			if (evaledParamMatrix.put(param.getName(), values) != null)
				throw new ValidationException("Duplicate param (" + param.getName() + ")");
		}
		validateParamMatrix(paramSpecs, evaledParamMatrix);
	}

	public static void validateParamMap(List<ParamSpec> paramSpecs, List<ParamInstance> paramMap) {
		Map<String, List<String>> evaledParamMap = new HashMap<>();
		for (ParamInstance param: paramMap) {
			List<String> value;
			if (param.getValueProvider() instanceof SpecifiedValue specifiedValue)
				value = specifiedValue.getValue();
			else
				value = null;
			if (evaledParamMap.put(param.getName(), value) != null)
				throw new ValidationException("Duplicate param (" + param.getName() + ")");
		}
		validateParamMap(paramSpecs, evaledParamMap);
	}
	

View on GitHub (pinned to d44925c47c)

Solutions

  1. Remove or rename the duplicated parameter entry so names are unique
  2. Merge the value lists of the duplicates into a single param
  3. Validate the YAML for repeated 'name:' entries under params

Example fix

// before
- name: version
  values: ["1.0"]
- name: version
  values: ["2.0"]
// after
- name: version
  values: ["1.0", "2.0"]
Defensive patterns

Strategy: validation

Validate before calling

Set<String> seen = new HashSet<>();
for (Param p : params)
    if (!seen.add(p.getName())) throw new IllegalArgumentException("duplicate param: " + p.getName());

Try / catch

try { ParamUtils.validateParamMatrix(specs, params); } catch (ValidationException e) { if (e.getMessage().startsWith("Duplicate param")) { /* merge or drop duplicate */ } }

Prevention

When it happens

Trigger: Calling validateParamMatrix with a param list containing two entries with identical getName(); put(param.getName(), values) returns a previous non-null entry.

Common situations: Duplicate YAML blocks for the same parameter in .onedev-buildspec.yml; merging param lists; UI/form code appending a param that already exists.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/f5393c650ef8a21f. Report an issue: GitHub.