theonedev/onedev · error · ValidationException

Error validating param values (param: %s, error message: %s)

Error message

Error validating param values (param: %s, error message: %s)

What it means

This is a wrapping error: when validateParamValues fails for a specific parameter, validateParamMatrix catches the ValidationException and rethrows it with the parameter name and the original message embedded. It tells you which param in the matrix failed and why (empty values or duplicates).

Source

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

		for (List<String> value: values) {
			if (encountered.contains(value)) 
				throw new ValidationException("Duplicate values not allowed");
			else 
				encountered.add(value);
		}
	}
	
	private static void validateParamMatrix(List<ParamSpec> paramSpecs, Map<String, List<List<String>>> paramMatrix) {
		Map<String, ParamSpec> paramSpecMap = ParamUtils.getParamSpecMap(paramSpecs);
		validateParamNames(paramSpecMap.keySet(), paramMatrix.keySet());
		for (Map.Entry<String, List<List<String>>> entry: paramMatrix.entrySet()) {
			if (entry.getValue() != null) {
				try {
					validateParamValues(entry.getValue());
				} catch (ValidationException e) {
					String errorMessage = String.format("Error validating param values (param: %s, error message: %s)", 
							entry.getKey(), e.getMessage());
					throw new ValidationException(errorMessage);
				}
				
				ParamSpec paramSpec = Preconditions.checkNotNull(paramSpecMap.get(entry.getKey()));
				for (List<String> value: entry.getValue()) 
					validateParamValue(paramSpec, entry.getKey(), value);
			}
		}
	}
	
	private static void validateParamValue(ParamSpec paramSpec, String paramName, List<String> paramValue) {
		try {
			Object object = paramSpec.convertToObject(paramValue);
			if (paramSpec instanceof SecretParam && object != null 
					&& !((String)object).startsWith(SecretInput.LITERAL_VALUE_PREFIX)) {
				if (!Project.get().getHierarchyJobSecrets().stream()
						.anyMatch(it->it.getName().equals(object))) {
					throw new ValidationException("Secret not found");
				}

View on GitHub (pinned to d44925c47c)

Solutions

  1. Read the embedded 'param' name and 'error message' to find the offending parameter
  2. Fix the underlying values list (non-empty, no duplicates) for that param
  3. Re-run buildspec validation

Example fix

// reported: Error validating param values (param: version, error message: At least one value needs to be specified)
// after
params:
  - name: version
    values: ["1.0"]
Defensive patterns

Strategy: try-catch

Validate before calling

paramMatrix.forEach((name, vals) -> { if (vals == null || vals.isEmpty()) throw new IllegalArgumentException("param " + name + " has no values"); });

Try / catch

try { ParamUtils.validateParamMatrix(paramSpecs, params); } catch (ValidationException e) { /* parse embedded param name from message and surface to user */ }

Prevention

When it happens

Trigger: Calling ParamUtils.validateParamMatrix where one entry of the paramMatrix map has a null/empty values list or duplicate combinations; the inner ValidationException message is formatted into this one.

Common situations: BuildSpec validation during job run or save; a single misconfigured parameter among many; nested error originally from errors 170/171.

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