# 新用户无法加入论坛，接受邀请导致内部服务器错误

**URL:** <https://meta.discourse.org/t/new-users-unable-to-join-the-forum-accepting-invitation-leads-to-internal-server-error/216482>\
**Category:** Support\
**Tags:** invites\
**Created:** [2022年一月30日 11:51 UTC](https://meta.discourse.org/t/new-users-unable-to-join-the-forum-accepting-invitation-leads-to-internal-server-error/216482 "2022-01-30T11:51:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Gruzglin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alex_gruzglin/32/242117_2.png) [@Alex\_Gruzglin](https://meta.discourse.org/u/Alex_Gruzglin)\
**Post date:** [2022年一月30日 11:51 UTC](https://meta.discourse.org/t/new-users-unable-to-join-the-forum-accepting-invitation-leads-to-internal-server-error/216482/1 "2022-01-30T11:51:58Z")

</div>

救命！  
我是 PractiTest 中 Discuss 论坛的管理员。

最近新用户无法登录，他们收到错误消息“出了点问题，用户名或电子邮件可能已注册。请尝试使用忘记密码链接。”  
当我邀请新用户时，他们会收到邀请电子邮件，但在填写所有详细信息后会显示“内部服务器错误”消息。  
我检查了错误日志，这是我在尝试接受邀请时看到的内容：

`ActiveRecord::RecordNotUnique (PG::UniqueViolation: ERROR: duplicate key value violates unique constraint \"user_emails_pkey\" DETAIL: Key (id)=(45) already exists. ) app/models/invite_redeemer.rb:80:`

`Failed to handle exception in exception app middleware : PG::UniqueViolation: ERROR: duplicate key value violates unique constraint \"user_emails_pkey\" DETAIL: Key (id)=(45) already exists.`

我尝试升级到最新的 Discourse 版本，并且似乎成功了（2.9.0.beta1）。

请帮忙！

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2022年一月31日 02:11 UTC](https://meta.discourse.org/t/new-users-unable-to-join-the-forum-accepting-invitation-leads-to-internal-server-error/216482/2 "2022-01-31T02:11:30Z")

</div>

您是从哪个版本升级的？PostgreSQL 是什么版本？

---

<div class="post-metadata">

**Author:** ![Alex\_Gruzglin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alex_gruzglin/32/242117_2.png) [@Alex\_Gruzglin](https://meta.discourse.org/u/Alex_Gruzglin)\
**Post date:** [2022年一月31日 07:23 UTC](https://meta.discourse.org/t/new-users-unable-to-join-the-forum-accepting-invitation-leads-to-internal-server-error/216482/3 "2022-01-31T07:23:35Z")

</div>

> [@pfaffman](#):
>
> 您是从哪个版本升级的？Postgres 是哪个版本？

不记得了，但这是我在日志中找到的：

```plaintext
from_version: 11d61cb
repository: /var/www/discourse/plugins/docker_manager

```

以及如何检查 Postgres 版本？

---

<div class="post-metadata">

**Author:** ![Alex\_Gruzglin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alex_gruzglin/32/242117_2.png) [@Alex\_Gruzglin](https://meta.discourse.org/u/Alex_Gruzglin)\
**Post date:** [2022年一月31日 10:28 UTC](https://meta.discourse.org/t/new-users-unable-to-join-the-forum-accepting-invitation-leads-to-internal-server-error/216482/4 "2022-01-31T10:28:49Z")

</div>

还有其他我可以提供的信息吗？

---

<div class="post-metadata">

**Author:** ![Alex\_Gruzglin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alex_gruzglin/32/242117_2.png) [@Alex\_Gruzglin](https://meta.discourse.org/u/Alex_Gruzglin)\
**Post date:** [2022年二月1日 07:30 UTC](https://meta.discourse.org/t/new-users-unable-to-join-the-forum-accepting-invitation-leads-to-internal-server-error/216482/5 "2022-02-01T07:30:35Z")

</div>

有人吗？  
我将非常感谢任何指导  
@pfaffman

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2022年二月1日 10:57 UTC](https://meta.discourse.org/t/new-users-unable-to-join-the-forum-accepting-invitation-leads-to-internal-server-error/216482/6 "2022-02-01T10:57:41Z")

</div>

我认为没有人提供答案是因为没有好的答案。

Postgres 版本在  
/var/discourse/shared/standalone/postgres\_data/PG\_VERSION  
或者类似的地方。我正在用手机。

听起来你有一个损坏的索引，我很久没见过了。解决方案是尝试重建索引，如果失败则删除或修复重复条目。这需要了解一些关于 SQL、索引和 Discourse 的知识。

你可以搜索“损坏的索引”。

也可能是别的原因。我以为在 postgres 13 上没有人遇到过这种情况。你的论坛运行多久了？

---

<div class="post-metadata">

**Author:** ![Alex\_Gruzglin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alex_gruzglin/32/242117_2.png) [@Alex\_Gruzglin](https://meta.discourse.org/u/Alex_Gruzglin)\
**Post date:** [2022年五月17日 08:28 UTC](https://meta.discourse.org/t/new-users-unable-to-join-the-forum-accepting-invitation-leads-to-internal-server-error/216482/7 "2022-05-17T08:28:40Z")

</div>

非常感谢，顺便说一句，这很有帮助！

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2022年五月17日 10:42 UTC](https://meta.discourse.org/t/new-users-unable-to-join-the-forum-accepting-invitation-leads-to-internal-server-error/216482/8 "2022-05-17T10:42:32Z")

</div>


