{"record":{"id":"f5393c650ef8a21f","repo":"theonedev/onedev","slug":"duplicate-param","errorCode":null,"errorMessage":"Duplicate param (","messagePattern":"Duplicate param \\(","errorType":"validation","errorClass":"ValidationException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/buildspec/param/ParamUtils.java","lineNumber":134,"sourceCode":"\t}\n\t\n\tpublic static Map<String, ParamSpec> getParamSpecMap(List<ParamSpec> paramSpecs) {\n\t\tMap<String, ParamSpec> paramSpecMap = new LinkedHashMap<>();\n\t\tfor (ParamSpec paramSpec: paramSpecs)\n\t\t\tparamSpecMap.put(paramSpec.getName(), paramSpec);\n\t\treturn paramSpecMap;\n\t}\n\n\tpublic static void validateParamMatrix(List<ParamSpec> paramSpecs, List<ParamInstances> paramMatrix) {\n\t\tMap<String, List<List<String>>> evaledParamMatrix = new HashMap<>();\n\t\tfor (ParamInstances param: paramMatrix) {\n\t\t\tList<List<String>> values;\n\t\t\tif (param.getValuesProvider() instanceof SpecifiedValues specifiedValues)\n\t\t\t\tvalues = specifiedValues.getValues();\n\t\t\telse\n\t\t\t\tvalues = null;\n\t\t\tif (evaledParamMatrix.put(param.getName(), values) != null)\n\t\t\t\tthrow new ValidationException(\"Duplicate param (\" + param.getName() + \")\");\n\t\t}\n\t\tvalidateParamMatrix(paramSpecs, evaledParamMatrix);\n\t}\n\n\tpublic static void validateParamMap(List<ParamSpec> paramSpecs, List<ParamInstance> paramMap) {\n\t\tMap<String, List<String>> evaledParamMap = new HashMap<>();\n\t\tfor (ParamInstance param: paramMap) {\n\t\t\tList<String> value;\n\t\t\tif (param.getValueProvider() instanceof SpecifiedValue specifiedValue)\n\t\t\t\tvalue = specifiedValue.getValue();\n\t\t\telse\n\t\t\t\tvalue = null;\n\t\t\tif (evaledParamMap.put(param.getName(), value) != null)\n\t\t\t\tthrow new ValidationException(\"Duplicate param (\" + param.getName() + \")\");\n\t\t}\n\t\tvalidateParamMap(paramSpecs, evaledParamMap);\n\t}\n\t","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/buildspec/param/ParamUtils.java#L116-L152","documentation":"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.","triggerScenarios":"Calling validateParamMatrix with a param list containing two entries with identical getName(); put(param.getName(), values) returns a previous non-null entry.","commonSituations":"Duplicate YAML blocks for the same parameter in .onedev-buildspec.yml; merging param lists; UI/form code appending a param that already exists.","solutions":["Remove or rename the duplicated parameter entry so names are unique","Merge the value lists of the duplicates into a single param","Validate the YAML for repeated 'name:' entries under params"],"exampleFix":"// before\n- name: version\n  values: [\"1.0\"]\n- name: version\n  values: [\"2.0\"]\n// after\n- name: version\n  values: [\"1.0\", \"2.0\"]","handlingStrategy":"validation","validationCode":"Set<String> seen = new HashSet<>();\nfor (Param p : params)\n    if (!seen.add(p.getName())) throw new IllegalArgumentException(\"duplicate param: \" + p.getName());","typeGuard":null,"tryCatchPattern":"try { ParamUtils.validateParamMatrix(specs, params); } catch (ValidationException e) { if (e.getMessage().startsWith(\"Duplicate param\")) { /* merge or drop duplicate */ } }","preventionTips":["Check YAML params section for repeated name entries before committing","Merge duplicate value lists into one param","Use maps keyed by name when constructing param lists"],"tags":["validation","params","duplicates"],"backgroundTag":"invalid-config-value","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}