{"record":{"id":"f2e75fd214958ead","repo":"theonedev/onedev","slug":"at-least-one-value-needs-to-be-specified","errorCode":null,"errorMessage":"At least one value needs to be specified","messagePattern":"At least one value needs to be specified","errorType":"validation","errorClass":"ValidationException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/buildspec/param/ParamUtils.java","lineNumber":34,"sourceCode":"import org.apache.commons.lang.SerializationUtils;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\nimport org.jspecify.annotations.Nullable;\nimport javax.validation.ValidationException;\nimport java.io.Serializable;\nimport java.util.*;\nimport java.util.stream.Collectors;\n\npublic class ParamUtils {\n\t\n\tprivate static final Logger logger = LoggerFactory.getLogger(ParamInstances.class);\n\t\n\tprivate static final String PARAM_BEAN_CLASS_NAME_PREFIX = \"BuildParamBean\";\n\t\n\tpublic static void validateParamValues(List<List<String>> values) {\n\t\tif (values.isEmpty())\n\t\t\tthrow new ValidationException(\"At least one value needs to be specified\");\n\t\tSet<List<String>> encountered = new HashSet<>();\n\t\tfor (List<String> value: values) {\n\t\t\tif (encountered.contains(value)) \n\t\t\t\tthrow new ValidationException(\"Duplicate values not allowed\");\n\t\t\telse \n\t\t\t\tencountered.add(value);\n\t\t}\n\t}\n\t\n\tprivate static void validateParamMatrix(List<ParamSpec> paramSpecs, Map<String, List<List<String>>> paramMatrix) {\n\t\tMap<String, ParamSpec> paramSpecMap = ParamUtils.getParamSpecMap(paramSpecs);\n\t\tvalidateParamNames(paramSpecMap.keySet(), paramMatrix.keySet());\n\t\tfor (Map.Entry<String, List<List<String>>> entry: paramMatrix.entrySet()) {\n\t\t\tif (entry.getValue() != null) {\n\t\t\t\ttry {\n\t\t\t\t\tvalidateParamValues(entry.getValue());\n\t\t\t\t} catch (ValidationException e) {\n\t\t\t\t\tString errorMessage = String.format(\"Error validating param values (param: %s, error message: %s)\", ","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/buildspec/param/ParamUtils.java#L16-L52","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nparams:\n  - name: version\n    values:\n// after\nparams:\n  - name: version\n    values:\n      - \"1.0\"\n      - \"2.0\"","handlingStrategy":"validation","validationCode":"if (values == null || values.isEmpty())\n    throw new IllegalArgumentException(\"param values must contain at least one combination\");","typeGuard":null,"tryCatchPattern":"try { ParamUtils.validateParamValues(values); } catch (ValidationException e) { /* show 'add at least one value' UI hint */ }","preventionTips":["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"],"tags":["validation","buildspec","params"],"backgroundTag":"empty-required-field","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}