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
- Log in with the existing account for that email, or use 'forgot password' if you never set one.
- Have an admin delete or rename the existing account using that email, then reuse the invitation.
- Request a new invitation with a different email address.
- 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
- Click invitation links only once; log in afterwards.
- Check for an existing account before inviting an email.
- Use unique emails per user.
- Admins: resolve email conflicts in user management before re-inviting.
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
- Should only enable normal users
- Should only convert normal users to service accounts
- Cannot set queries and watches for disabled user
- Cannot set queries and watches for service or ai account
- Root user cannot be deleted
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/733e20a5d3b7e25e.
Report an issue: GitHub.