theonedev/onedev · error · ExplicitException

Attribute '%s' is reserved

Error message

Attribute '%s' is reserved

What it means

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.

Source

Thrown at server-core/src/main/java/io/onedev/server/service/impl/DefaultAgentService.java:176

	public String getAgentVersion() {
		return agentVersion;
	}

	@Override
	public Collection<String> getAgentLibs() {
		return agentLibs;
	}

	@Transactional
	@Override
	public Long agentConnected(AgentData data, Session session) {
		for (String attributeName: data.getAttributes().keySet()) {
			if (!AttributeNameValidator.PATTERN.matcher(attributeName).matches()) {
				throw new ExplicitException("Attribute '" + attributeName + "' should start and end with "
						+ "alphanumeric or underscore. Only alphanumeric, underscore, dash, space and "
						+ "dot are allowed in the middle.");
			} else if (Agent.ALL_FIELDS.contains(attributeName)) { 
				throw new ExplicitException("Attribute '" + attributeName + "' is reserved");
			}
		}
		
		AgentToken token = Preconditions.checkNotNull(tokenService.find(data.getToken()));
		Agent agent = findByToken(token);
		if (agent == null) {
			agent = new Agent();
			agent.setToken(token);
			agent.setOsName(data.getOsInfo().getOsName());
			agent.setOsVersion(data.getOsInfo().getOsVersion());
			agent.setOsArch(data.getOsInfo().getOsArch());
			agent.setName(data.getName());
			agent.setCpuCount(data.getCpus());
			agent.setIpAddress(data.getIpAddress());

			AgentLastUsedDate lastUsedDate = new AgentLastUsedDate();
			agent.setLastUsedDate(lastUsedDate);
			dao.persist(lastUsedDate);

View on GitHub (pinned to d44925c47c)

Solutions

  1. Rename the attribute in the agent's data to a non-reserved name.
  2. Stop sending the reserved attribute; the server manages it itself.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server-core/src/main/java/io/onedev/server/service/impl/DefaultAgentService.java:176 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/f1dfc9aa0ae6afc1. Report an issue: GitHub.