{"record":{"id":"f29eea0c33f6a80c","repo":"RocketChat/Rocket.Chat","slug":"room-not-found-f29eea","errorCode":"room-not-found","errorMessage":"Room not found","messagePattern":"Room not found","errorType":"exception","errorClass":"RoomNotFoundError","httpStatus":null,"severity":"warning","filePath":"apps/meteor/client/views/room/hooks/useOpenRoom.ts","lineNumber":74,"sourceCode":"\t\t// we need to add uid and username here because `user` is not loaded all at once (see UserProvider -> Meteor.user())\n\t\tqueryKey: roomsQueryKeys.roomReference(reference, type, user?._id, user?.username),\n\n\t\t// Render immediately from local cache when we already know the rid; queryFn still runs in\n\t\t// the background to revalidate permissions / fetch fresh room fields.\n\t\tplaceholderData: tryCacheShortcut,\n\n\t\tqueryFn: async (): Promise<{ rid: IRoom['_id'] }> => {\n\t\t\tconst cached = tryCacheShortcut();\n\t\t\tif (cached) {\n\t\t\t\tLegacyRoomManager.open({ typeName: type + reference, rid: cached.rid });\n\t\t\t\treturn cached;\n\t\t\t}\n\t\t\tif ((user && !user.username) || (!user && !allowAnonymousRead)) {\n\t\t\t\tthrow new NotAuthorizedError();\n\t\t\t}\n\n\t\t\tif (!reference || !type) {\n\t\t\t\tthrow new RoomNotFoundError(undefined, { type, reference });\n\t\t\t}\n\n\t\t\tlet roomData: IRoom;\n\t\t\ttry {\n\t\t\t\troomData = await getRoomByTypeAndName(type, reference);\n\t\t\t} catch (error) {\n\t\t\t\tconst errorCode = error && typeof error === 'object' && 'error' in error ? error.error : undefined;\n\n\t\t\t\t// \"No permission\" means the room exists but the user can't see it — surface the\n\t\t\t\t// not-found/no-access screen rather than retrying it as a transient failure.\n\t\t\t\tif (errorCode === 'error-no-permission') {\n\t\t\t\t\tthrow new RoomNotFoundError(undefined, { type, reference });\n\t\t\t\t}\n\n\t\t\t\tif (errorCode !== 'error-invalid-room') {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/client/views/room/hooks/useOpenRoom.ts#L56-L92","documentation":"Thrown as RoomNotFoundError ('room-not-found') when either reference or type is falsy at the point the queryFn needs them to call the getRoomByTypeAndName method. These come from route params; a missing value means the URL/route is malformed for room resolution.","triggerScenarios":"Navigating to a room route with an empty type or reference segment (e.g. /group// or /channel/); route param parsing returned undefined due to a malformed deep link; programmatic navigation that omitted required params.","commonSituations":"Stale/bookmarked URL with a missing segment; custom integration building a room URL incorrectly; a redirect that strips the reference.","solutions":["Validate the route params at the route component boundary and redirect to /home when type/reference are missing.","Fix the link/redirect source to always include both type and reference.","Render a 'room not found' page instead of letting the query run with empty params."],"exampleFix":"// before\nif (!reference || !type) {\n  throw new RoomNotFoundError(undefined, { type, reference });\n}\n\n// after: guard at component level\nif (!reference || !type) {\n  return <RoomNotFoundScreen />;\n}","handlingStrategy":"validation","validationCode":"// Guard at the route component boundary.\nif (!type || !reference) {\n  router.navigate('/home', { replace: true });\n  return;\n}","typeGuard":"const hasRoomRouteParams = (p: { type?: unknown; reference?: unknown }): p is { type: RoomType; reference: string } =>\n  typeof p.type === 'string' && p.type.length > 0 &&\n  typeof p.reference === 'string' && p.reference.length > 0;","tryCatchPattern":null,"preventionTips":["Validate route params before invoking useOpenRoom.","Construct room deep links with both type and reference always present.","Redirect malformed URLs to /home rather than running the query."],"tags":["client","routing","rooms","validation"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}