# 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:** 1
**Showing post:** 12

<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)

---

_[View the full topic](https://meta.discourse.org/t/502-error-chatables/392286)._
