theonedev/onedev · error · NotAcceptableException

Email address with noreply domain is not allowed

Error message

Email address with noreply domain is not allowed

What it means

OneDev reserves a noreply mail domain for system-generated addresses; if the submitted email value parses to a login name in that domain (User.getLoginName(value) != null), creation is rejected. Such addresses would collide with the system's noreply naming scheme.

Source

Thrown at server-core/src/main/java/io/onedev/server/rest/resource/EmailAddressResource.java:81

	public boolean isEmailAddressVerified(@PathParam("emailAddressId") Long emailAddressId) {
		EmailAddress emailAddress = emailAddressService.load(emailAddressId);
    	if (!SecurityUtils.isAdministrator() && !emailAddress.getOwner().equals(getAuthUser())) 
			throw new UnauthorizedException();
    	return emailAddress.isVerified();
	}
	
	@Api(order=200, description="Create new email address")
	@POST
	public Long createEmailAddress(@NotNull @Valid EmailAddress emailAddress) {
		var owner = emailAddress.getOwner();
		if (!SecurityUtils.isAdministrator() && !owner.equals(getAuthUser()))
			throw new UnauthorizedException();
		else if (owner.isDisabled())
			throw new NotAcceptableException("Cannot set email address for disabled user");
		else if (owner.getType() != User.Type.ORDINARY)
			throw new NotAcceptableException("Cannot set email address for service or ai user");
		else if (User.getLoginName(emailAddress.getValue()) != null)
			throw new NotAcceptableException("Email address with noreply domain is not allowed");
		else if (emailAddressService.findByValue(emailAddress.getValue()) != null)
			throw new NotAcceptableException("This email address is already used by another user");
		
		if (SecurityUtils.isAdministrator()) 
			emailAddress.setVerificationCode(null);
		
		emailAddressService.create(emailAddress);

		if (!getAuthUser().equals(owner)) 
			auditService.audit(null, "added email address \"" + emailAddress.getValue() + "\" in account \"" + owner.getName() + "\" via RESTful API", null, null);
		return emailAddress.getId();
	}
	
	@Api(order=250, description="Set as primary email address")
	@Path("/primary")
	@POST
	public Long setAsPrimary(@NotNull Long emailAddressId) {
		var emailAddress = emailAddressService.load(emailAddressId);

View on GitHub (pinned to d44925c47c)

Solutions

  1. Use a real deliverable email domain not matching the noreply domain
  2. Validate the address value client-side against the configured noreply domain before submitting
  3. Sanitize import data to drop noreply-domain addresses

Example fix

// before
EmailAddress ea = new EmailAddress();
ea.setValue("bot@noreply.example.com");
// after
EmailAddress ea = new EmailAddress();
ea.setValue("bot@example.com");
Defensive patterns

Strategy: validation

Validate before calling

if (User.getLoginName(value) != null) reject 'noreply domain address';

Type guard

boolean usableAddress = User.getLoginName(value) == null;

Try / catch

try { createEmailAddress(ea); } catch (NotAcceptableException e) { /* noreply domain: use real domain */ }

Prevention

When it happens

Trigger: POST an EmailAddress whose value uses the reserved noreply domain (e.g. something@noreply.domain configured for the server).

Common situations: Migrating data that includes old noreply-style addresses; tests using example addresses that accidentally match the noreply domain; bulk imports without value validation.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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