[SOLVED] Missing users in @-autocomplete


Some users don’t appear in the autocomplete box that pops up for @-mentions or search.

Steps to reproduce

Server version 3.7.1, various clients. Either:

  • in the Post area, type @
  • in the search box, type from:

Expected behavior

All active users should be visible.

Observed behavior

Some users are entirely missing from the autocomplete list - however, if the full username is typed, the @-mention works normally.

The same users are still missing after a restart of the server and missing regardless of the current channel in the client.

I can’t discern any pattern in the users that are missing (nor do I know the complete list).

BTW we have about 300 users in the team, if that makes any difference.

Hi @gubbins,

Thanks for your report!

Mattermost 3.8.0 has been released. Could you try upgrading your installation to the latest version and see whether the issue reproduces for you?


Will do @lindy, but I might wait for 3.8.1 since we use Gitlab for auth and I saw on the release notes that there’s an issue with that in 3.8.0.

Sounds good @gubbins! Thanks :slight_smile:

Let us know how it goes!

I just upgraded to 3.8.2. Unfortunately the behaviour is unchanged.

It also seems to be getting more prevalent (by which I mean the number of users missing in autocomplete seems to be increasing, and more users are noticing the problem and getting frustrated).

Even worse, it’s hard to open direct chats to affected users - creating a chat and typing in their username doesn’t work (they’re not in the popup, but even if you type their correct username anyway, you can’t add them to the list). The only way I know of to open a direct chat is to click on their avatar in a channel and use the Send Message link, which does still work.

There are no errors in the log since restart (set to INFO level).

This has become a fairly big problem for us. I am surprised nobody else has reported it - I am wondering what could be different in our installation.

One more observation: if we just type the @ sign, then the pop-up list is complete and we can scroll through and see everyone; it’s only as we start to type letters that we get incomplete results.

Hi @gubbins,

I’ve just had a thought but will need you to test it out to see whether this might be your issue…

Can you go to your “Town Square” channel and

  1. type @ in the center channel message box
  2. in the search box type in:town-square from:

Can you compare the list of names that appears for 1. and 2. above and let me know whether they’re the same?

I think the issue you might be experiencing is that typing @ in any channel only brings up a list of channel members whereas typing from: in the search box brings up a list of all users on the team.

Let me know how it goes.


OK, so just looking at users whose usernames start with c as an example:

  • in Town Square, type @ and then scroll down
    • under C, I see all 18 users whose usernames start with c
  • in Town Square, type @c
    • under C, I now only see 4 users
  • in the search box, type from:
    • under C, I see all 18 users
  • in the search box, type from:c
    • under C, I see only 4 (the same 4 as above)
  • in the search box, type in:town-square from:
    • under C, I see all 18 users
  • in the search box, type in:town-square from:c
    • under C, I see only 4 (the same 4 as above)

The filtering by letter always seems to cut out the same users regardless of the channel in which I do it (or indeed the dialog used to create new Direct Messages, as mentioned). I think something is going wrong in that filtering.

Hi @gubbins!

Thanks for the feedback!

When using from: in the searchbox, your own logged in username will also appear in the list so this will add one user to the overall list (as you can also search for messages from yourself).

That said, I’m not able to reproduce the disappearing users as you’ve detailed in your steps above. I’m thinking it might be because there is a problem with the GitLab omnibus installation.

I’m going to link in @eric, one of our product specialists who might be able to shed some light on the issue.

Let’s see whether we can get to the root cause of your issue!

Thanks @lindy65 (but note we’re not using the GitLab omnibus installation)

In other news, I reverse-engineered the MySQL query that I believe will get run on the server for such autocomplete queries, having traced it back to https://github.com/mattermost/platform/blob/master/store/sql_user_store.go. For our Town Square channel, with just “c” as the search term, I believe it would be this:

SELECT Users.FirstName FROM Users, ChannelMembers WHERE ChannelMembers.ChannelId = '8r95qhjqgirhmpx6nxt6f83kuh' AND ChannelMembers.UserId = Users.Id AND MATCH(Username, FirstName, LastName, Nickname, Email) AGAINST ('+c*' IN BOOLEAN MODE);

Interestingly, the results of this again include only 4 users with usernames starting with c (not all 18). If I understand the query right, it should include all 18 users whose usernames start with c. I played with some variations of the query and got some rather odd results. I wonder if there’s some issue with our MySQL version, or the index is corrupt or something?

Ah sorry, I misunderstood. I see you’re just using GitLab for auth!

I’m sure Eric will have some additional thoughts / suggestions. In the meantime, thought I’d let you know that we are working on improving search and have elastic search on the roadmap for next release on May 16th.


@eric, since the queries I run directly produce the same results as the autocompletes in the client, I think it must be an issue with our DB - do you agree? I just don’t get results I understand for those queries…

@eric / @lindy65 - this appears to be resolved after running optimize table Users on our database, to force re-creation of indices. The SQL queries seem to work as expected and our autocompletes look like they’re working again.

I am not sure how the index got in a bad state in the DB but likely nothing to do with mattermost itself!

That’s great news @gubbins! Glad to hear your issue is resolved!

I’ll mark this as resolved for now but please let us know if there’s anything else we can help with…