theonedev/onedev · error · ValidationException
Duplicate values not allowed
Error message
Duplicate values not allowed
What it means
Thrown by ParamUtils.validateParamValues when the same value combination (List<String>) appears more than once for a parameter. Duplicates are meaningless for a value matrix and would create ambiguous param instances, so validation rejects them. validateParamMatrix wraps this with the param name for context.
Source
Thrown at server-core/src/main/java/io/onedev/server/buildspec/param/ParamUtils.java:38
import org.jspecify.annotations.Nullable;
import javax.validation.ValidationException;
import java.io.Serializable;
import java.util.*;
import java.util.stream.Collectors;
public class ParamUtils {
private static final Logger logger = LoggerFactory.getLogger(ParamInstances.class);
private static final String PARAM_BEAN_CLASS_NAME_PREFIX = "BuildParamBean";
public static void validateParamValues(List<List<String>> values) {
if (values.isEmpty())
throw new ValidationException("At least one value needs to be specified");
Set<List<String>> encountered = new HashSet<>();
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);
}
View on GitHub (pinned to d44925c47c)
Solutions
- Remove the duplicate value row so each combination is unique
- If multiple params share values, use one row with multiple columns instead of repeated rows
- Deduplicate programmatically before calling validateParamValues
Example fix
// before values: [["1.0"], ["1.0"]] // after values: [["1.0"], ["2.0"]]
Defensive patterns
Strategy: validation
Validate before calling
Set<List<String>> seen = new HashSet<>();
for (List<String> row : values)
if (!seen.add(row)) throw new IllegalArgumentException("duplicate value combination: " + row); Try / catch
try { ParamUtils.validateParamValues(values); } catch (ValidationException e) { /* deduplicate and retry */ } Prevention
- Deduplicate value rows before saving the buildspec
- Avoid copy-pasting param blocks in YAML
- Use a LinkedHashSet when building value lists programmatically
When it happens
Trigger: Calling validateParamValues with a list containing two identical List<String> entries, e.g. values [["a"],["a"]], typically from SpecifiedValues in a BuildSpec.
Common situations: Copy-pasting a value row in the YAML or in the job parameter form; merging param lists from two sources; UI allowing repeated rows.
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
- At least one value needs to be specified
- Error validating param values (param: %s, error message: %s)
- Error validating param value (param: %s, value: %s, error me
- Missing job parameter (
- Unknown job parameter (
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/9df32e21404385b0.
Report an issue: GitHub.