{"record":{"id":"4345b9cc0d6b00f9","repo":"RocketChat/Rocket.Chat","slug":"mention-bot-failed-to-retrieve-path-to-room","errorCode":null,"errorMessage":"Mention bot - Failed to retrieve path to room","messagePattern":"Mention bot - Failed to retrieve path to room","errorType":"exception","errorClass":"Error","httpStatus":500,"severity":"error","filePath":"apps/meteor/server/modules/core-apps/mention.module.ts","lineNumber":84,"sourceCode":"\t\t\t\t\tlng: user.language,\n\t\t\t\t}),\n\t\t\t\ttmid: message.tmid,\n\t\t\t\t_id: payload.message,\n\t\t\t\tmentions,\n\t\t\t});\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (actionId === 'share-message') {\n\t\t\tconst sub = await Subscriptions.findOneByRoomIdAndUserId(room, user._id, { projection: { t: 1, rid: 1, name: 1 } });\n\t\t\t// this should exist since the event is fired from withing the room (e.g the user sent a message)\n\t\t\tif (!sub) {\n\t\t\t\tthrow new Error('Mention bot - Failed to retrieve room information');\n\t\t\t}\n\n\t\t\tconst roomPath = roomCoordinator.getRouteLink(sub.t, { rid: sub.rid, name: sub.name });\n\t\t\tif (!roomPath) {\n\t\t\t\tthrow new Error('Mention bot - Failed to retrieve path to room');\n\t\t\t}\n\n\t\t\tconst messageText = i18n.t('Youre_not_a_part_of__channel__and_I_mentioned_you_there', {\n\t\t\t\tchannel: `#${sub.name}`,\n\t\t\t\tlng: user.language,\n\t\t\t});\n\n\t\t\tconst link = new URL(Meteor.absoluteUrl(roomPath));\n\t\t\tlink.searchParams.set('msg', message._id);\n\t\t\tconst text = `[ ](${link.toString()})\\n${messageText}`;\n\n\t\t\t// forwards message to all DMs\n\t\t\tawait processWebhookMessage(\n\t\t\t\t{\n\t\t\t\t\troomId: mentions.map(({ _id }) => _id),\n\t\t\t\t\ttext,\n\t\t\t\t\tseparateResponse: true, // so that messages are sent to other DMs even if one or more fails\n\t\t\t\t},","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/modules/core-apps/mention.module.ts#L66-L102","documentation":"Second guard in the mention bot's 'share-message' action: after finding the user's subscription, roomCoordinator.getRouteLink(sub.t, { rid: sub.rid, name: sub.name }) must resolve a web route for the subscription's room type. If no route is registered for that type on the server, no deep link can be built and the action aborts with this error.","triggerScenarios":"A subscription whose room type (sub.t) has no route registered in the server's roomCoordinator at runtime — a custom or fork-specific room type added without a server-side route registration, or a partial deploy where the room-type route provider did not load.","commonSituations":"Custom room types registered only on the client; enterprise/fork room types missing in a community build; stale subscription documents referencing a room type the deployment no longer supports.","solutions":["Check the subscription's t field in the database and confirm that room type has a route registered server-side","Register the missing route for the custom room type in its server-side room provider (roomCoordinator/roomProvider registration)","Migrate or clean stale subscriptions that point at room types your build no longer supports","Catch the error and fall back to a plain deep link (Meteor.absoluteUrl) so the share still works"],"exampleFix":"// before\nconst roomPath = roomCoordinator.getRouteLink(sub.t, { rid: sub.rid, name: sub.name }); // may be undefined -> throw\n\n// after\nconst roomPath = roomCoordinator.getRouteLink(sub.t, { rid: sub.rid, name: sub.name }) ?? `channel/${sub.name ?? sub.rid}`;","handlingStrategy":"try-catch","validationCode":"const roomTypeHasRoute = (t: string): boolean =>\n  Boolean(roomCoordinator.getRouteLink(t, { rid: 'probe', name: 'probe' }));","typeGuard":null,"tryCatchPattern":"try {\n  await mentionModule.blockAction(payload);\n} catch (error) {\n  if (error instanceof Error && error.message === 'Mention bot - Failed to retrieve path to room') {\n    // no route for this room type; fall back to a bare absolute URL\n    return shareWithFallbackUrl(payload);\n  }\n  throw error;\n}","preventionTips":["Register a server-side route for every custom room type you add","Test the 'share-message' banner action for each room type present in your deployment","Clean up subscriptions that reference room types your build no longer registers"],"tags":["uikit","mention-bot","room-routing","room-coordinator"],"backgroundTag":"unregistered-room-type","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}