{"record":{"id":"8d86101d6074be0e","repo":"theonedev/onedev","slug":"secret-not-found","errorCode":null,"errorMessage":"Secret not found","messagePattern":"Secret not found","errorType":"validation","errorClass":"ValidationException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/buildspec/param/ParamUtils.java","lineNumber":71,"sourceCode":"\t\t\t\t\t\t\tentry.getKey(), e.getMessage());\n\t\t\t\t\tthrow new ValidationException(errorMessage);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tParamSpec paramSpec = Preconditions.checkNotNull(paramSpecMap.get(entry.getKey()));\n\t\t\t\tfor (List<String> value: entry.getValue()) \n\t\t\t\t\tvalidateParamValue(paramSpec, entry.getKey(), value);\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprivate static void validateParamValue(ParamSpec paramSpec, String paramName, List<String> paramValue) {\n\t\ttry {\n\t\t\tObject object = paramSpec.convertToObject(paramValue);\n\t\t\tif (paramSpec instanceof SecretParam && object != null \n\t\t\t\t\t&& !((String)object).startsWith(SecretInput.LITERAL_VALUE_PREFIX)) {\n\t\t\t\tif (!Project.get().getHierarchyJobSecrets().stream()\n\t\t\t\t\t\t.anyMatch(it->it.getName().equals(object))) {\n\t\t\t\t\tthrow new ValidationException(\"Secret not found\");\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\tif (e.getMessage() == null)\n\t\t\t\tlogger.error(\"Error validating field value\", e);\n\t\t\t\n\t\t\tList<String> displayValue;\n\t\t\tif (paramSpec instanceof SecretParam) {\n\t\t\t\tdisplayValue = new ArrayList<>();\n\t\t\t\tfor (String each: paramValue) {\n\t\t\t\t\tif (each.startsWith(SecretInput.LITERAL_VALUE_PREFIX))\n\t\t\t\t\t\tdisplayValue.add(SecretInput.MASK);\n\t\t\t\t\telse\n\t\t\t\t\t\tdisplayValue.add(each);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdisplayValue = paramValue;\n\t\t\t}","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/buildspec/param/ParamUtils.java#L53-L89","documentation":"Thrown by ParamUtils.validateParamValue when a SecretParam's value is not a literal (@secrets: prefixed) expression and no secret with that name exists in the current project's hierarchy of job secrets. OneDev requires referenced secrets to be defined on the project or an ancestor project.","triggerScenarios":"A job parameter of type secret is set to a plain string that does not start with SecretInput.LITERAL_VALUE_PREFIX and does not match any secret name returned by Project.get().getHierarchyJobSecrets().","commonSituations":"Typo in secret name; secret defined in another project not in the hierarchy; secret deleted or renamed after the buildspec referenced it; forgetting the @secrets: prefix when intending a literal value.","solutions":["Create the secret with that exact name in the project (Project > Secrets) or a parent project","Fix the typo so the value matches an existing secret name","Prefix the value with @secrets: if it is meant as a literal value, not a secret reference"],"exampleFix":"// before\n- name: deployKey\n  secret: true\n  value: deploy-key-typo\n// after (secret 'deploy-key' defined in project secrets)\n- name: deployKey\n  secret: true\n  value: deploy-key","handlingStrategy":"validation","validationCode":"boolean exists = Project.get().getHierarchyJobSecrets().stream()\n    .anyMatch(s -> s.getName().equals(secretName));\nif (!exists) throw new IllegalStateException(\"secret not defined: \" + secretName);","typeGuard":null,"tryCatchPattern":"try { ParamUtils.validateParamMap(specs, params); } catch (ValidationException e) { if (e.getMessage().contains(\"Secret not found\")) { /* prompt user to create secret */ } }","preventionTips":["Create referenced secrets in the project or a parent project before using them","Use @secrets: prefix for literal values in secret params","Keep secret names consistent via naming conventions; avoid ad-hoc renames"],"tags":["validation","secrets","params"],"backgroundTag":"resource-not-found","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"}