theonedev/onedev · error · ExplicitException

Email address already used:

Error message

Email address already used: 

What it means

In the same UserInvitation load model, if the invitation exists but its email address is already registered in the system (getEmailAddressService().findByValue(...) != null), OneDev throws ExplicitException('Email address already used: <address>') to prevent creating a duplicate user from an invitation.

Source

Thrown at server-core/src/main/java/io/onedev/server/web/page/security/CreateUserFromInvitationPage.java:55

public class CreateUserFromInvitationPage extends SimplePage {

	private final String PARAM_INVITATION_CODE = "invitationCode";
	
	private final IModel<UserInvitation> invitationModel;
	
	public CreateUserFromInvitationPage(PageParameters params) {
		super(params);
		
		String invitationCode = params.get(PARAM_INVITATION_CODE).toString();
		invitationModel = new LoadableDetachableModel<UserInvitation>() {

			@Override
			protected UserInvitation load() {
				UserInvitation invitation = getInvitationService().findByInvitationCode(invitationCode);
				if (invitation == null)
					throw new ExplicitException(_T("Invalid invitation code"));
				else if (getEmailAddressService().findByValue(invitation.getEmailAddress()) != null)
					throw new ExplicitException(_T("Email address already used: ") + invitation.getEmailAddress());
				else
					return invitation;
			}
			
		};
	}
	
	@Override
	protected void onInitialize() {
		super.onInitialize();

		User newUser = new User();
		BeanEditor editor = BeanContext.edit("editor", newUser, Sets.newHashSet(PROP_TYPE, PROP_NOTIFY_OWN_EVENTS), true);
		
		Form<?> form = new Form<Void>("form") {

			@Override
			protected void onSubmit() {

View on GitHub (pinned to d44925c47c)

Solutions

  1. Log in with the existing account for that email, or use 'forgot password' if you never set one.
  2. Have an admin delete or rename the existing account using that email, then reuse the invitation.
  3. Request a new invitation with a different email address.
  4. Check Server Admin for which user currently owns the email shown in the message.
Defensive patterns

Strategy: fallback

Validate before calling

if (emailAddressService.findByValue(invitation.getEmailAddress()) != null) {
  // sign in or reset password for the existing account instead
}

Try / catch

try {
  acceptInvitation(code);
} catch (ExplicitException e) {
  if (e.getMessage().startsWith("Email address already used")) {
    // route to login / password reset
  }
}

Prevention

When it happens

Trigger: Accepting an invitation whose email address already belongs to an existing user/email record — typically because the invitation link was opened after the account was already created, or another user already occupies that email.

Common situations: Clicking the invitation link twice (account created on first click); inviting an email that later got registered via normal sign-up; user re-signing-up with the same address after deleting only their invitation.

Related errors


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