{"record":{"id":"273ca7ac31bf4d3b","repo":"RocketChat/Rocket.Chat","slug":"room-not-found-273ca7","errorCode":null,"errorMessage":"Room not found","messagePattern":"Room not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"apps/meteor/client/views/room/hooks/useGoToRoom.ts","lineNumber":32,"sourceCode":"\tconst router = useRouter();\n\tconst getRoomInfo = useEndpoint('GET', '/v1/rooms.info');\n\tconst dispatchToastMessage = useToastMessageDispatch();\n\n\t// TODO: remove params recycling\n\treturn useStableCallback(async (roomId: IRoom['_id'], options?: GoToRoomByIdOptions) => {\n\t\tif (!roomId) return;\n\n\t\tconst subscription: ISubscription | undefined = Subscriptions.state.find((record) => record.rid === roomId);\n\n\t\tif (subscription) {\n\t\t\troomCoordinator.openRouteLink(subscription.t, subscription, router.getSearchParameters(), options);\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst { room } = await getRoomInfo({ roomId });\n\t\t\tif (!room) {\n\t\t\t\tthrow new Error('Room not found');\n\t\t\t}\n\t\t\troomCoordinator.openRouteLink(room.t, { rid: room._id, ...room }, router.getSearchParameters(), options);\n\t\t} catch (error) {\n\t\t\tdispatchToastMessage({ type: 'error', message: error });\n\t\t}\n\t});\n};\n","sourceCodeStart":14,"sourceCodeEnd":40,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/client/views/room/hooks/useGoToRoom.ts#L14-L40","documentation":"Thrown inside useGoToRoom when GET /v1/rooms.info succeeds (no HTTP error) but the response body contains no room field. It signals the server returned a 200 with an empty/missing room payload for the given roomId, so the client treats the room as nonexistent. The surrounding try/catch immediately converts it into an error toast via dispatchToastMessage.","triggerScenarios":"Calling goToRoomById with a roomId that the server cannot resolve (deleted room, stale id from a notification/link); rooms.info returning success:true with room omitted for a room the user lacks permission to view; passing an empty/whitespace roomId that slipped past the early `if (!roomId) return`.","commonSituations":"User clicks a notification or mention for a room they were just removed from; room was deleted between notification creation and click; cross-workspace shared link where the id does not exist locally.","solutions":["Validate/refresh the roomId source (notification payload, link) before calling; drop references to known-deleted rooms.","In the catch block, distinguish a missing-room case and navigate the user back to /home or show a 'room unavailable' state instead of only a toast.","If rooms.info consistently returns no room for valid ids, check server logs for the rooms collection / subscription sync state."],"exampleFix":"// before\nconst { room } = await getRoomInfo({ roomId });\nif (!room) {\n  throw new Error('Room not found');\n}\n\n// after\nconst { room } = await getRoomInfo({ roomId });\nif (!room) {\n  dispatchToastMessage({ type: 'error', message: 'Room not found' });\n  router.navigate('/home', { replace: true });\n  return;\n}","handlingStrategy":"try-catch","validationCode":"// Validate roomId shape and existence from local cache before the network call.\nconst cached = Rooms.state.get(roomId);\nif (!cached && !/^[A-Za-z0-9]{17}$/.test(roomId)) {\n  dispatchToastMessage({ type: 'error', message: 'Invalid room id' });\n  return;\n}","typeGuard":"const hasRoom = (res: unknown): res is { room: { _id: string; t: string } } =>\n  typeof res === 'object' && res !== null &&\n  'room' in res && typeof (res as any).room?._id === 'string';","tryCatchPattern":"try {\n  const res = await getRoomInfo({ roomId });\n  if (!hasRoom(res)) {\n    dispatchToastMessage({ type: 'error', message: 'Room not found' });\n    router.navigate('/home', { replace: true });\n    return;\n  }\n  roomCoordinator.openRouteLink(res.room.t, { rid: res.room._id, ...res.room }, router.getSearchParameters(), options);\n} catch (error) {\n  dispatchToastMessage({ type: 'error', message: error });\n}","preventionTips":["Strip references to rooms known to be deleted from notification/link sources.","Prefer navigating via subscription records when available.","Differentiate 'not found' from network errors in the catch so users aren't misled."],"tags":["client","navigation","rooms","rest-api"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}