{"record":{"id":"5b2862ec104e8415","repo":"theonedev/onedev","slug":"not-eligible-for-multi-value-5b2862","errorCode":null,"errorMessage":"Not eligible for multi-value","messagePattern":"Not eligible for multi-value","errorType":"validation","errorClass":"ValidationException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/buildspecmodel/inputspec/SecretInput.java","lineNumber":35,"sourceCode":"\tpublic static String getPropertyDef(InputSpec inputSpec, Map<String, Integer> indexes) {\n\t\tint index = indexes.get(inputSpec.getName());\n\t\tStringBuffer buffer = new StringBuffer();\n\t\tinputSpec.appendField(buffer, index, \"String\");\n\t\tinputSpec.appendCommonAnnotations(buffer, index);\n\t\tbuffer.append(\"    @NotEmpty\\n\");\n\t\tbuffer.append(\"    @Password\\n\");\n\t\tinputSpec.appendMethods(buffer, index, \"String\", null, null);\n\t\t\n\t\treturn buffer.toString();\n\t}\n\n\tpublic static Object convertToObject(List<String> strings) {\n\t\tif (strings.size() == 0)\n\t\t\treturn null;\n\t\telse if (strings.size() == 1)\n\t\t\treturn strings.iterator().next();\n\t\telse\n\t\t\tthrow new ValidationException(\"Not eligible for multi-value\");\n\t}\n\n\tpublic static List<String> convertToStrings(Object value) {\n\t\tif (value instanceof String)\n\t\t\treturn Lists.newArrayList((String)value);\n\t\telse\n\t\t\treturn new ArrayList<>();\n\t}\n\n}\n","sourceCodeStart":17,"sourceCodeEnd":46,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/buildspecmodel/inputspec/SecretInput.java#L17-L46","documentation":"SecretInput.convertToObject converts a single-element string list into the secret's String value. Because a secret input holds exactly one value (or none), a list with more than one element triggers 'Not eligible for multi-value'.","triggerScenarios":"Calling SecretInput.convertToObject(List<String>) with a list containing two or more strings, e.g. a job/buildspec input bound to a secret that receives multiple values.","commonSituations":"Automation or a script passing several secret values or a joined/quoted list into a single secret input; form/UI changes sending multiple selections where the input is single-valued; misconfigured buildspec copy-pasted from a multi-value input.","solutions":["Pass a list with at most one secret value string.","If multiple secrets are needed, define multiple separate secret inputs instead of one.","Inspect the source of the value list (UI binding or script) and ensure only one value is produced."],"exampleFix":"// before\nObject value = SecretInput.convertToObject(Lists.newArrayList(\"token1\", \"token2\"));\n\n// after\nObject value = SecretInput.convertToObject(Lists.newArrayList(\"token1\"));","handlingStrategy":"validation","validationCode":"boolean validSecretInput(List<String> strings) {\n    return strings == null || strings.size() <= 1;\n}","typeGuard":null,"tryCatchPattern":"try {\n    Object secret = SecretInput.convertToObject(values);\n} catch (ValidationException e) {\n    // secret inputs hold at most one value\n}","preventionTips":["Define one secret input per secret; never pack multiple secrets into one input.","Check that UI bindings/scripts emit a single value for single-valued inputs."],"tags":["validation","buildspec","secret","multi-value"],"backgroundTag":"invalid-argument-value","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"}