RocketChat / RocketChat/Rocket.Chat
"Uncaught Error" in some group chats with new message template in Desktop App
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description:
"Oops! Something went wrong. Please reload the page or contact an administrator." error while viewing some chats.
Problem occurs only in Desktop App and only for some group chats (I haven't found any differences in chats working fine and failing).
Browser version works fine for all chats failing in Desktop app.
Enabling "Use legacy message template" in My Account > Preferences fixes the problem.
Steps to reproduce:
- Open some chat created in previous RC version in Desktop App.
Expected behavior:
Chat is opened, all messages are visible, history is being loaded while scrolling.
Actual behavior:
[+] chat opened
[+] message history shown
[!] in 2-3 seconds after chat is opened and message history shown

Server Setup Information:
- Version of Rocket.Chat Server: 5.0.4
- Operating System: Unubtu 20.04
- Deployment Method: docker
- Number of Running Instances: 1
- DB Replicaset Oplog: oplog Enabled
- NodeJS Version: v14.19.3
- MongoDB Version: 5.0.11 / wiredTiger
Client Setup Information
- Desktop App or Browser Version: Desktop App v 3.8.7
- Operating System: Windows 10
Additional context
none
Relevant logs:
Browser logs:

[Browser logs pasted as text here become unreadable]
"componentStack" property for Uncaught Error: TypeError: Cannot read properties of undefined (reading 'indexOf') (num.2 on the screenshot)
"
at O (/client/views/room/MessageList/components/MessageContent.tsx:1:1719)
at div
at va
at div
at https://chat.domain.ltd/de2a0a98a668e5a193ce98f6f7dfcb36e7148079.js?meteor_js_resource=true:13:504489
at v (/client/views/room/MessageList/components/Message.tsx:1:1156)
at a (/client/views/room/MessageList/providers/MessageHighlightProvider.tsx:1:311)
at l (/client/views/room/providers/SelectedMessagesProvider.tsx:1:1022)
at e (/client/views/room/providers/MessageProvider.tsx:1:999)
at B (/client/views/room/providers/ToolboxProvider.tsx:1:997)
at e (/client/views/room/MessageList/providers/MessageListProvider.tsx:1:1231)
at t (https://chat.domain.ltd/de2a0a98a668e5a193ce98f6f7dfcb36e7148079.js?meteor_js_resource=true:1044:29683)
at d (/client/views/room/MessageList/MessageListErrorBoundary.tsx:1:400)
at q (/client/views/room/MessageList/MessageList.tsx:1:1413)
at Suspense
at https://chat.domain.ltd/de2a0a98a668e5a193ce98f6f7dfcb36e7148079.js?meteor_js_resource=true:1558:1129517
at p (/client/views/root/AppLayout.tsx:1:424)
at m (https://chat.domain.ltd/de2a0a98a668e5a193ce98f6f7dfcb36e7148079.js?meteor_js_resource=true:1558:1054424)
at d (/client/components/message/Attachments/providers/AttachmentProvider.tsx:1:362)
at L (/client/providers/OmnichannelProvider.tsx:1:1010)
at Q (/client/providers/CallProvider/CallProvider.tsx:1:1792)
at g (/client/providers/VideoConfProvider.tsx:1:618)
at P (/client/providers/AuthorizationProvider.tsx:1:932)
at d (/client/providers/ModalProvider.tsx:1:349)
at d (/client/providers/DeviceProvider/DeviceProvider.tsx:1:388)
at g (/client/providers/UserProvider.tsx:1:813)
at c (/client/providers/CustomSoundProvider.tsx:1:245)
at v (/client/providers/AvatarUrlProvider.tsx:1:489)
at r (/client/providers/LayoutProvider.tsx:1:350)
at y (/client/providers/SettingsProvider.tsx:1:706)
at h (/client/providers/ToastMessagesProvider.tsx:1:453)
at p (/node_modules/@rocket.chat/fuselage-toastbar/dist/esm/ToastBarProvider.js:1:709)
at g (/client/providers/ToastMessagesProvider.tsx:1:748)
at v (/client/providers/TooltipProvider.tsx:1:435)
at l (/client/providers/SessionProvider.tsx:1:353)
at d (/client/providers/TranslationProvider.js:1:1203)
at k (/client/providers/RouterProvider.tsx:1:967)
at h (/client/providers/ServerProvider.tsx:1:1002)
at i (/client/providers/ConnectionStatusProvider.tsx:1:399)
at D (/client/providers/MeteorProvider.tsx:1:1150)
at e (https://chat.domain.ltd/de2a0a98a668e5a193ce98f6f7dfcb36e7148079.js?meteor_js_resource=true:1218:63317)
at Suspense
at f"
SERVER LOGS
No relevant logs
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure in the Desktop App with a group chat created in a previous RC version and the new message template enabled. Read client/views/room/MessageList/components/MessageContent.tsx and trace the reported undefined indexOf error through Message.tsx and the message-list providers. Done means affected chats open without the uncaught error, display all messages, and continue loading history while scrolling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- desktop, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100