theonedev/onedev · error · ValidationException
At least one value needs to be specified
Error message
At least one value needs to be specified
What it means
This ValidationException is thrown by ParamUtils.validateParamValues when the list of value-combinations for a job parameter is empty. BuildSpec job parameters defined with a values provider must specify at least one value combination; an empty list means the parameter can never take a value, so validation fails fast. The message is later wrapped by validateParamMatrix with the offending param name.
Source
Thrown at server-core/src/main/java/io/onedev/server/buildspec/param/ParamUtils.java:34
import org.apache.commons.lang.SerializationUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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)", View on GitHub (pinned to d44925c47c)
Solutions
- Add at least one value (row) to the parameter's specified values list
- If the parameter should not constrain values, remove the values provider / parameter instead of leaving it empty
- Check YAML indentation so values are actually parsed into the list rather than dropped
Example fix
// before
params:
- name: version
values:
// after
params:
- name: version
values:
- "1.0"
- "2.0" Defensive patterns
Strategy: validation
Validate before calling
if (values == null || values.isEmpty())
throw new IllegalArgumentException("param values must contain at least one combination"); Try / catch
try { ParamUtils.validateParamValues(values); } catch (ValidationException e) { /* show 'add at least one value' UI hint */ } Prevention
- Always define at least one default value row for each specified-values param
- Validate the buildspec YAML before committing
- In UI forms, disable save until values list is non-empty
When it happens
Trigger: Calling ParamUtils.validateParamValues with an empty List<List<String>>, typically via validateParamMatrix when a BuildParam's SpecifiedValues.getValues() returns an empty list for a parameter.
Common situations: A developer defines a job parameter in .onedev-buildspec.yml with `values:` left empty or removes all values from the list; UI form saved with no rows; programmatic BuildSpec construction passing new ArrayList<>() as values.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- Duplicate values not allowed
- 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/f2e75fd214958ead.
Report an issue: GitHub.