{"record":{"id":"f1dfc9aa0ae6afc1","repo":"theonedev/onedev","slug":"attribute-s-is-reserved","errorCode":null,"errorMessage":"Attribute '%s' is reserved","messagePattern":"Attribute '(.+?)' is reserved","errorType":"validation","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/service/impl/DefaultAgentService.java","lineNumber":176,"sourceCode":"\tpublic String getAgentVersion() {\n\t\treturn agentVersion;\n\t}\n\n\t@Override\n\tpublic Collection<String> getAgentLibs() {\n\t\treturn agentLibs;\n\t}\n\n\t@Transactional\n\t@Override\n\tpublic Long agentConnected(AgentData data, Session session) {\n\t\tfor (String attributeName: data.getAttributes().keySet()) {\n\t\t\tif (!AttributeNameValidator.PATTERN.matcher(attributeName).matches()) {\n\t\t\t\tthrow new ExplicitException(\"Attribute '\" + attributeName + \"' should start and end with \"\n\t\t\t\t\t\t+ \"alphanumeric or underscore. Only alphanumeric, underscore, dash, space and \"\n\t\t\t\t\t\t+ \"dot are allowed in the middle.\");\n\t\t\t} else if (Agent.ALL_FIELDS.contains(attributeName)) { \n\t\t\t\tthrow new ExplicitException(\"Attribute '\" + attributeName + \"' is reserved\");\n\t\t\t}\n\t\t}\n\t\t\n\t\tAgentToken token = Preconditions.checkNotNull(tokenService.find(data.getToken()));\n\t\tAgent agent = findByToken(token);\n\t\tif (agent == null) {\n\t\t\tagent = new Agent();\n\t\t\tagent.setToken(token);\n\t\t\tagent.setOsName(data.getOsInfo().getOsName());\n\t\t\tagent.setOsVersion(data.getOsInfo().getOsVersion());\n\t\t\tagent.setOsArch(data.getOsInfo().getOsArch());\n\t\t\tagent.setName(data.getName());\n\t\t\tagent.setCpuCount(data.getCpus());\n\t\t\tagent.setIpAddress(data.getIpAddress());\n\n\t\t\tAgentLastUsedDate lastUsedDate = new AgentLastUsedDate();\n\t\t\tagent.setLastUsedDate(lastUsedDate);\n\t\t\tdao.persist(lastUsedDate);","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/service/impl/DefaultAgentService.java#L158-L194","documentation":"agentConnected iterates the attribute map sent by a newly connecting agent and rejects reserved attribute names (matched against a reserved-name set) so agents cannot override server-managed attributes like version or IP.","triggerScenarios":"Thrown at server-core/src/main/java/io/onedev/server/service/impl/DefaultAgentService.java:176 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rename the attribute in the agent's data to a non-reserved name.","Stop sending the reserved attribute; the server manages it itself."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}