{"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":null,"httpStatus":null,"severity":"error","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/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/client/views/room/hooks/useGoToRoom.ts#L14-L40","documentation":"Thrown by the useGoToRoom client hook when a room id is not in the local Subscriptions store and the fallback GET /v1/rooms.info call either succeeds with an empty body or returns no `room` field. It means the id does not correspond to any room the server will disclose to the current user. The surrounding catch converts it into an error toast, so the user just sees the failure message.","triggerScenarios":"Calling goToRoom(roomId) with a deleted room id, an id from a stale link/notification for a room the user was removed from, a mistyped/foreign rid, or when rooms.info returns success without a room payload. Also fires when the user has no subscription and lacks permission to fetch the room's info.","commonSituations":"Clicking a permalink or mention to a room deleted during a retention cleanup; opening a room id persisted in localStorage from a previous session after the user lost access; passing a channel id where a message id was expected.","solutions":["Verify the rid actually exists via GET /v1/rooms.info?roomId=... with the same user token and inspect the response.","If the room was deleted or the user was removed, stop navigating and show an inline 'room unavailable' state instead of calling the hook.","Clear stale ids from persisted state (unread bars, search history) when rooms.info comes back empty rather than retrying.","If the room should exist, check that the authenticated user has at least viewer membership or that the room is public."],"exampleFix":"// before\nawait goToRoom(rid); // toast: Room not found\n\n// after\nconst { room } = await getEndpoint('GET', '/v1/rooms.info')({ roomId: rid });\nif (!room) {\n\tshowInlineMessage('This room is no longer available');\n\treturn;\n}\nawait goToRoom(rid);","handlingStrategy":"try-catch","validationCode":"const roomExists = async (rid: string): Promise<boolean> => {\n\tconst { room } = await getEndpoint('GET', '/v1/rooms.info')({ roomId: rid }).catch(() => ({ room: undefined }));\n\treturn Boolean(room?._id);\n};","typeGuard":"const isRoomMissing = (error: unknown): boolean =>\n\tBoolean(error && typeof error === 'object' && 'message' in error && (error as Error).message.includes('Room not found'));","tryCatchPattern":"try {\n\tawait goToRoom(rid);\n} catch (error) {\n\tif (isRoomMissing(error)) {\n\t\t// terminal: room id unknown to server, do not retry\n\t\tshowInlineState('room-unavailable');\n\t\treturn;\n\t}\n\tdispatchToastMessage({ type: 'error', message: error }); // network/auth errors surface as toast\n}","preventionTips":["Treat a missing rooms.info payload as terminal — never auto-retry with the same rid.","Purge persisted room ids (notifications, search history) when the room lookup fails.","Avoid calling goToRoom with ids parsed from untrusted URLs without prior validation."],"tags":["client","room","rest-api","navigation"],"backgroundTag":"resource-not-found","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}