Private Channel Also Appears in "Direct Messages" Category (and This Link is Only Partially Working)

For feature requests, please see:

For troubleshooting questions, please post in the following format:


Mattermost server 5.19.1 LTS.

A newly created private channel somehow also appears in the “Direct Messages” category in the UI (besides the expected entry under “Private Channels”).


There it works as long as the correct team is active, and the channel fails to load if you click this wrong entry if another Team is active. (Probably as the Channel simply does not exist in this Team.)

Steps to reproduce

Not quite sure.

  • I created a Private Channel with the name “AE/CV/BEC-Compare-Abstimmungen diese Woche” (internal name: aecvbec-compare-abstimmungen-diese-woche),
  • added a bunch of users
  • and then noticed the strange entry.

Not sure when it appeared exactly.

Expected behavior

The private channel only appears in the “Private Channels” list / category, not under “Direct Messages”.

Observed behavior

See summary.

Hi @GOhrner,
thanks for reporting this.
The bug has already been fixed and fix will be coming with version 5.22 in April.

Best regards,

Ok, great!

In which cases does this happen, so is there any workaround to avoid those “phantom direct messages” until then?

And will it also be backported to 5.19 LTS?

Hey there @GOhrner. From our tests we found a specific pattern which was reported in the bug that Sven mentioned : However it seems to be a different pattern than the one you are experiencing. One of the workarounds I found from the tests was that if there were no dash (-) symbols it wouldn’t happen. Perhaps you might want to try removing the dash symbols from the channel name and test if it can avoid the behavior from happening?

1 Like

Hi, @GOhrner

As of now, I don’t see any workarounds available so far. I have tested this on my end across multiple versions and can confirm that the issue persists even after I removed the hyphens from the channel name and reloaded the app.

The issue will not occur when you created the channel without the hyphens, for example AE CV BEC Compare Abstimmungen diese Woche:

The issue actually just has to do with the length of the channel name so whether there are dashes or not doesn’t make a difference, any channel name with a length of 40 characters results in this bug for any version prior to the upcoming 5.22.

A work around would be to remove the existing Preferences entries generated in the database with a query like

DELETE Preferences FROM Preferences
	Channels ON Channels.Id = Preferences.Name 
	Preferences.category = 'group_channel_show' 
	(Channels.Type = 'O' OR Channels.Type = 'P')

Hi, @fm2munsh

I tried to run the SQL query on 5.21 with the affected channel but the it continues to be displayed in both Private and Direct Messages even after I clear the cache and logged out from the desktop app:

mysql> DELETE Preferences FROM Preferences INNER JOIN Channels ON Channels.Id = Preferences.Name WHERE Preferences.category = 'group_channel_show' AND (Channels.Type = 'O' OR Channels.Type = 'P');
Query OK, 2 rows affected (0.01 sec)

May I know if there are any additional step that I need to perform after running the SQL statement?

The cache would have to be cleared from the system console afterwards

edit: Actually I dont think this would work the sys console cache is for sessions - I think one way would be to run the query and then immediately reboot the server

@fm2munsh any plans of backporting the fix for this to 5.19.0?

This has been fixed in v5.19.2 dot release

1 Like