# 502 error - chatables

**URL:** https://meta.discourse.org/t/502-error-chatables/392286
**Category:** UX
**Tags:** chat
**Created:** [December 28, 2025, 10:18pm UTC](https://meta.discourse.org/t/502-error-chatables/392286 "2025-12-28T22:18:23Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [December 28, 2025, 10:18pm UTC](https://meta.discourse.org/t/502-error-chatables/392286/1 "2025-12-28T22:18:23Z")

</div>

I got a 502 error here on Meta today. Apart from the pop up, I didn’t notice any unexpected behavior. I am not really sure what caused this, and I am not consistently able to reproduce it, but I was able to trigger it a few times.

Here is what I did:

1. I used the + in the sidebar to open the DM chat with someone I talked to before but who is currently not in my sidebar.
2. I used the full-screen chat button.
3. I changed the size of the browser window so it was smaller.
4. I made the browser window full screen again.
5. I switched from full-screen chat back to the small chat window.
6. About 7 seconds later, I saw  
 ![image](https://global.discourse-cdn.com/meta/original/4X/0/4/3/043b83baa697258d24e21c32c224a2d7b0a609ee.png)

The browser console showed:

 ![image](https://global.discourse-cdn.com/meta/original/4X/5/4/a/54ae2919f596f51a73656fdf0fcc128c68b8902a.png)

That’s all I have. I hope someone can make more of it than I can. If it helps, I have a video showing how I reproduced this.

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [December 28, 2025, 10:30pm UTC](https://meta.discourse.org/t/502-error-chatables/392286/2 "2025-12-28T22:30:09Z")

</div>

> [@Moin](#):
>
> I used the + in the sidebar to open the DM chat with someone I talked to before but who is currently not in my sidebar.

Maybe it’s caused by this step? Is it possible that it happens when you search for someone in that chat filter?

 ![image](https://global.discourse-cdn.com/meta/original/4X/e/b/2/eb2f6e930a540488f72f156713afc47fd60922f7.png)

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [December 28, 2025, 11:51pm UTC](https://meta.discourse.org/t/502-error-chatables/392286/3 "2025-12-28T23:51:53Z")

</div>

I think I found the step I need to reproduce: When I type “L” into the chat filter the error appears about 30 seconds later

 ![image](https://global.discourse-cdn.com/meta/original/4X/f/3/2/f32ffc5308fe4b1bf0459efd8cf9b4ce88a12e98.png)

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [December 29, 2025, 5:43pm UTC](https://meta.discourse.org/t/502-error-chatables/392286/5 "2025-12-29T17:43:19Z")

</div>

There was an bad query that was used to return the count of users with chat enabled in the chat group serializer and it was taking ~30s for your account which is the request timeout on our hosting (hence why you were getting it “randomly”)

[https://github.com/discourse/discourse/pull/36893](https://github.com/discourse/discourse/pull/36893)

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [December 30, 2025, 2:17pm UTC](https://meta.discourse.org/t/502-error-chatables/392286/6 "2025-12-30T14:17:58Z")

</div>

Hmm, I see that it has been merged. Does that mean the error should no longer occur?

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [December 30, 2025, 2:22pm UTC](https://meta.discourse.org/t/502-error-chatables/392286/7 "2025-12-30T14:22:53Z")

</div>

> [@Moin](#):
>
> Does that mean the error should no longer occur?

If I root caused it correctly, yes 😅

Is it still happening?

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [December 30, 2025, 2:25pm UTC](https://meta.discourse.org/t/502-error-chatables/392286/8 "2025-12-30T14:25:07Z")

</div>

It does, maybe less frequently. It’s strange; sometimes it takes a few seconds and the users are shown, and sometimes it fails.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [December 30, 2025, 2:48pm UTC](https://meta.discourse.org/t/502-error-chatables/392286/9 "2025-12-30T14:48:24Z")

</div>

😥

When it happens, can you show the network’s tab and the request that’s taking a long time?

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [December 30, 2025, 3:00pm UTC](https://meta.discourse.org/t/502-error-chatables/392286/10 "2025-12-30T15:00:50Z")

</div>

Sigh. You ask that as if it only took two mouse clicks.

I’ll try.

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [December 30, 2025, 3:06pm UTC](https://meta.discourse.org/t/502-error-chatables/392286/11 "2025-12-30T15:06:21Z")

</div>

That’s what I mean by saying that sometimes it takes a few seconds, and sometimes it fails:

![image](https://global.discourse-cdn.com/meta/original/4X/3/6/b/36bc4e9a41754b9f575d19c14ceefccce16cb532.png)

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [December 30, 2025, 8:52pm UTC](https://meta.discourse.org/t/502-error-chatables/392286/12 "2025-12-30T20:52:47Z")

</div>

Ok, I figured it out 😅

My first fix only addressed part of the issue 🤦‍♂️ There was another inefficient database query happening when searching for groups in the chat filter. Depending on which groups matched your search term, the query could take a very long time to complete – sometimes exceeding our request timeout.

Interestingly, this only affected “regular” users and not “admins”, hence why I wasn’t able to reproduce myself 🤔

When searching for groups, results are returned alphabetically. Admins can see all groups, so their first 10 results for “L” were small groups starting with ‘a’ (like “ai-personas” and other non-public groups). Regular users have more limited visibility, so their results included the large trust level groups 😬, which is what caused the slow query.

Regular user sees:

- trust\_level\_0: 62,506 users
- trust\_level\_1: 34,494 users
- trust\_level\_2: 4,727 users
- trust\_level\_3: 39 users
- trust\_level\_4: 13 users
- plus some smaller groups

Total: ~102,000 users to load 💥

Admin sees:

- a\*\*\*\*\*: 4 users
- a\*\*\*\*\*: 76 users
- a\*\*\*\*\*: 0 users
- a\*\*\*\*\*: 2 users
- ai-personas: 138 users
- etc.

Total: ~240 users to load 😌

[https://github.com/discourse/discourse/pull/36922](https://github.com/discourse/discourse/pull/36922)

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [December 30, 2025, 9:11pm UTC](https://meta.discourse.org/t/502-error-chatables/392286/13 "2025-12-30T21:11:48Z")

</div>

> [@zogstrip](#):
>
> “ai-personas”

Why does searching for “L” return that group?

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [December 30, 2025, 9:26pm UTC](https://meta.discourse.org/t/502-error-chatables/392286/14 "2025-12-30T21:26:24Z")

</div>

Just me failing at “anonymizing” the data and coming up with an example 🤦‍♂️

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [December 30, 2025, 9:30pm UTC](https://meta.discourse.org/t/502-error-chatables/392286/15 "2025-12-30T21:30:46Z")

</div>

The full name of the group contains an L, so I wasn’t sure if that was the reason, or if it was a random example.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [January 8, 2026, 10:08am UTC](https://meta.discourse.org/t/502-error-chatables/392286/16 "2026-01-08T10:08:56Z")

</div>


