{"record":{"id":"ffbcbcc5695a7035","repo":"RocketChat/Rocket.Chat","slug":"invalid-room-ffbcbc","errorCode":null,"errorMessage":"invalid-room","messagePattern":"invalid-room","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/services/video-conference/service.ts","lineNumber":82,"sourceCode":"const { db } = MongoInternals.defaultRemoteCollectionDriver().mongo;\n\nconst logger = new Logger('VideoConference');\n\nexport class VideoConfService extends ServiceClassInternal implements IVideoConfService {\n\tprotected name = 'video-conference';\n\n\t// VideoConference.create: Start a video conference using the type and provider specified as arguments\n\tpublic async create(\n\t\t{ type, rid, createdBy, providerName, ...data }: VideoConferenceCreateData,\n\t\tuseAppUser = true,\n\t): Promise<VideoConferenceInstructions> {\n\t\treturn wrapExceptions(async () => {\n\t\t\tconst room = await Rooms.findOneById<Pick<IRoom, '_id' | 't' | 'uids' | 'name' | 'fname'>>(rid, {\n\t\t\t\tprojection: { t: 1, uids: 1, name: 1, fname: 1 },\n\t\t\t});\n\n\t\t\tif (!room) {\n\t\t\t\tthrow new Error('invalid-room');\n\t\t\t}\n\n\t\t\tconst user = await Users.findOneById<IUser>(createdBy);\n\t\t\tif (!user) {\n\t\t\t\tthrow new Error('failed-to-load-own-data');\n\t\t\t}\n\n\t\t\tif (type === 'direct') {\n\t\t\t\tif (!isRoomCompatibleWithVideoConfRinging(room.t, room.uids)) {\n\t\t\t\t\tthrow new Error('type-and-room-not-compatible');\n\t\t\t\t}\n\n\t\t\t\treturn this.startDirect(providerName, user, room, data);\n\t\t\t}\n\n\t\t\tif (type === 'livechat') {\n\t\t\t\treturn this.startLivechat(providerName, user, rid);\n\t\t\t}","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/e4b8178b205510181a96ceefee043d0abcd13e5a/apps/meteor/server/services/video-conference/service.ts#L64-L100","documentation":"Thrown by VideoConferenceService.create when Rooms.findOneById(rid) returns null — the room in which the call should start does not exist. This is the first guard in create, running before the caller-user and type checks, and it applies to all call types (direct, livechat, group).","triggerScenarios":"POST video-conference/create (or the UI call button) with a rid that was deleted, mistyped, or belongs to another deployment; calling create with undefined rid because the client never loaded the room record.","commonSituations":"Stale room id cached by the web client after the room was deleted; tests seeding calls without seeding rooms; multi-instance setups pointing at different databases.","solutions":["Load the room before creating the call and abort with a clear UI message if missing","Derive rid from a live subscription/room payload, never from a URL fragment or stale state","Re-fetch room state when the room screen mounts so deleted rooms surface early","Seed Rooms in test fixtures whenever seeding video conference calls"],"exampleFix":"// before\nawait VideoConfService.create({ type, rid, createdBy, providerName });\n\n// after\nconst room = await Rooms.findOneById(rid, { projection: { t: 1, uids: 1 } });\nif (!room) throw new Error('invalid-room');\nawait VideoConfService.create({ type, rid, createdBy, providerName });","handlingStrategy":"validation","validationCode":"const room = await Rooms.findOneById(rid, { projection: { _id: 1 } });\nif (!room) {\n  throw new Meteor.Error('invalid-room', 'Room not found');\n}","typeGuard":null,"tryCatchPattern":"try {\n  const instructions = await VideoConfService.create(payload);\n} catch (err) {\n  if (err instanceof Error && err.message === 'invalid-room') {\n    // show 'room no longer exists' and refresh the room list\n  }\n  throw err;\n}","preventionTips":["Derive rid from a live subscription record, never from stale state","Handle room-deleted events to close call UIs","Validate rid format before hitting the API"],"tags":["video-conference","rooms","lookup"],"backgroundTag":"resource-not-found","analyzedSha":"e4b8178b205510181a96ceefee043d0abcd13e5a","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}