# Invite links show error for Admin users

**URL:** https://meta.discourse.org/t/invite-links-show-error-for-admin-users/234277
**Category:** Bug
**Tags:** invites
**Created:** [July 28, 2022, 2:13pm UTC](https://meta.discourse.org/t/invite-links-show-error-for-admin-users/234277 "2022-07-28T14:13:02Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![gassim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gassim/32/220910_2.png) [@gassim](https://meta.discourse.org/u/gassim)
#### Post date: [July 28, 2022, 2:13pm UTC](https://meta.discourse.org/t/invite-links-show-error-for-admin-users/234277/1 "2022-07-28T14:13:02Z")

</div>

Hi

Invitation links that are working for standard users show an error for logged in admin users. The following is a screenshot of the error:

 ![670x180](https://global.discourse-cdn.com/meta/original/4X/d/d/d/ddded9cc2505325a47213b2574c9516e33b0dddc.png)  
And this is a screenshot of the Network response:  
 ![690x112](https://global.discourse-cdn.com/meta/original/4X/b/8/4/b84ad6b0d124f8951b74c4764d9af6bd3889d4fb.png)

* * *

The invitation links are created by system, adds users to groups and redirects them to topic post. Working well for standard users and have been so for a while now. However, this error started appearing only for admin users.

Please help! I’m posting this with hopes that this will be fixed and it won’t be something we’ll need to fix for standard users as well.

Thank you!

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [July 28, 2022, 2:26pm UTC](https://meta.discourse.org/t/invite-links-show-error-for-admin-users/234277/2 "2022-07-28T14:26:28Z")

</div>

Hi @gassim 🙂

Is there more detail in `/logs` you could share?

I searched Meta for that error message and there’s a mention about `minimum username length` from some time back in a similar situation: [Setting 'min username length' greater than 5 breaks granting and revoking Admin/Moderator permissions - #10 by RGJ](https://meta.discourse.org/t/setting-min-username-length-greater-than-5-breaks-granting-and-revoking-admin-moderator-permissions/57079/10) Could that be relevant?

---

<div class="post-metadata">

### Author: ![gassim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gassim/32/220910_2.png) [@gassim](https://meta.discourse.org/u/gassim)
#### Post date: [August 2, 2022, 9:06am UTC](https://meta.discourse.org/t/invite-links-show-error-for-admin-users/234277/3 "2022-08-02T09:06:30Z")

</div>

Hi @JammyDodger,

Thanks! However, it doesn’t seem relevant nor is it a similar situation.

> [@Setting 'min username length' greater than 5 breaks granting and revoking Admin/Moderator permissions](https://meta.discourse.org/t/setting-min-username-length-greater-than-5-breaks-granting-and-revoking-admin-moderator-permissions/57079/10):
>
> Since ‘staff’ is an existing group name, setting the min username length to anything other than 3, 4 or 5 will break granting and revoking admin if you do not rename the staff group first.

We’re not making any change here. The invite links used to work but now when an admin clicks on an invite link the error above appears which never appeared before.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [August 2, 2022, 4:17pm UTC](https://meta.discourse.org/t/invite-links-show-error-for-admin-users/234277/4 "2022-08-02T16:17:26Z")

</div>

That was a bit of a longshot. 🙂 I thought possibly the admin invite links were causing a similar conflict, but if you haven’t updated that setting then perhaps not.

Hopefully your `/logs` can provide more detailed info for the error?

---

<div class="post-metadata">

### Author: ![gassim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gassim/32/220910_2.png) [@gassim](https://meta.discourse.org/u/gassim)
#### Post date: [September 2, 2022, 9:30am UTC](https://meta.discourse.org/t/invite-links-show-error-for-admin-users/234277/5 "2022-09-02T09:30:24Z")

</div>

Thanks @JammyDodger! Sorry for taking long.

> [@JammyDodger](#):
>
> Is there more detail in `/logs` you could share?

Here’s the /log error (which is not supposed to happen):  
`ActiveRecord::RecordInvalid (Validation failed: Primary email has already been taken) app/models/invite_redeemer.rb:72:in `create_user_from_invite' app/models/invite_redeemer.rb:144:in `get_invited_us`

* * *

`Failed to handle exception in exception app middleware : ActiveRecord::RecordInvalid : Validation failed: Primary email has already been taken`

* * *

It’s not supposed to do that! What it used to do before is that if I’m logged in and used an invite link, it would simply add me to the group (if I’m not already a member in) and it’d redirect me to the topic post.

rather than display the error:

> [@gassim](#):
>
> ![670x180](https://global.discourse-cdn.com/meta/original/4X/d/d/d/ddded9cc2505325a47213b2574c9516e33b0dddc.png)
