theonedev/onedev · error · ExplicitException
Invalid invitation code
Error message
Invalid invitation code
What it means
CreateUserFromInvitationPage loads a UserInvitation by the invitationCode page parameter. If getInvitationService().findByInvitationCode(code) returns null, it throws ExplicitException(_T("Invalid invitation code")) — the code is unknown, meaning it was never issued, already consumed/deleted, or mistyped.
Source
Thrown at server-core/src/main/java/io/onedev/server/web/page/security/CreateUserFromInvitationPage.java:53
import io.onedev.server.web.page.simple.SimplePage;
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") {
View on GitHub (pinned to d44925c47c)
Solutions
- Request a fresh invitation link from the administrator.
- Check the invitationCode parameter in the URL is complete and not truncated or altered.
- If you already accepted the invitation, log in with the created account instead.
- Ask an admin to re-issue the invitation (Server Admin > invitations/user management).
Defensive patterns
Strategy: fallback
Validate before calling
UserInvitation inv = invitationService.findByInvitationCode(code);
if (inv == null) { /* request a new invitation before opening the form */ } Try / catch
try {
openInvitationPage(code);
} catch (ExplicitException e) {
// show 'request a new invitation' UI
} Prevention
- Use invitation links exactly as issued, single-use.
- Request fresh links rather than reusing old ones.
- Admins: avoid deleting invitations still pending acceptance.
- Copy the full URL from the invitation email.
When it happens
Trigger: Visiting the create-user-from-invitation URL with an invitationCode that does not match any stored UserInvitation — wrong/mistyped code, invitation already used and removed, or invitation deleted by an administrator.
Common situations: Reusing an invitation link after the invited account was already created; truncated code when copying the email link; admin purged expired invitations; server data restored/migrated losing invitations.
Related errors
- Authentication required
- Unauthenticated
- Not authenticated
- Unable to import build spec (import project: {0}, import rev
- Invalid access token
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/eaef41c5f5c2f3ca.
Report an issue: GitHub.