{"record":{"id":"b23341464ce5eaa6","repo":"RocketChat/Rocket.Chat","slug":"roomid-was-not-provided","errorCode":null,"errorMessage":"roomId was not provided.","messagePattern":"roomId was not provided\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/meteor/app/apps/server/bridges/rooms.ts","lineNumber":379,"sourceCode":"\n\t\tif (!subscription) {\n\t\t\tconst errorMessage = `No subscription found for user with ID \"${uid}\" in room with ID \"${roomId}\". This means the user is not subscribed to the room.`;\n\t\t\tthis.orch.debugLog(errorMessage);\n\t\t\tthrow new Error('User not subscribed to room');\n\t\t}\n\n\t\tconst lastSeen = subscription?.ls;\n\t\tif (!lastSeen) {\n\t\t\treturn 0;\n\t\t}\n\n\t\treturn Messages.countVisibleByRoomIdBetweenTimestampsNotContainingTypes(roomId, lastSeen, new Date(), []);\n\t}\n\n\tprotected async removeUsers(roomId: string, usernames: Array<string>, appId: string): Promise<void> {\n\t\tthis.orch.debugLog(`The App ${appId} is removing users ${usernames} from room id: ${roomId}`);\n\t\tif (!roomId) {\n\t\t\tthrow new Error('roomId was not provided.');\n\t\t}\n\n\t\tconst members = await Users.findUsersByUsernames(usernames, { limit: 50 }).toArray();\n\t\tawait Promise.all(members.map((user) => removeUserFromRoom(roomId, user)));\n\t}\n}\n","sourceCodeStart":361,"sourceCodeEnd":386,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/app/apps/server/bridges/rooms.ts#L361-L386","documentation":"Guard in the rooms bridge removeUsers: the roomId argument is falsy, so the bridge refuses to run removeUserFromRoom for the given usernames. Rocket.Chat addresses rooms solely by their _id, and an empty id would match nothing or the wrong document.","triggerScenarios":"App calls removeUsers with roomId as '', undefined, or null — typically from an unset slash-command parameter, a misnamed parameter (rid vs roomId), or destructuring a field that is not present.","commonSituations":"Slash commands and UIKit handlers reading the room id from the wrong context property; optional parameters used without validation; renames during refactors leaving an undefined variable.","solutions":["Pass the id of an existing room, taken from the triggering context (message.room.id or the interaction's room).","Validate required parameters at handler entry and fail fast with a clear message.","If the room may be gone, check it via the room reader before removing users."],"exampleFix":"// before\nawait removeUsers(params.room ?? '', usernames, appId);\n\n// after\nconst roomId = context.getRoom()?.id;\nif (!roomId) {\n  throw new Error('A room is required to remove users');\n}\nawait removeUsers(roomId, usernames, appId);","handlingStrategy":"validation","validationCode":"const roomId = context.getRoom()?.id ?? message.room.id;\nif (!roomId) {\n  throw new Error('roomId is required to remove users');\n}","typeGuard":"const isNonEmptyString = (v: unknown): v is string =>\n  typeof v === 'string' && v.trim().length > 0;","tryCatchPattern":null,"preventionTips":["Validate required params at handler entry.","Read room ids from the live context, not from optional user input.","Fail fast with a clear message instead of forwarding empty ids."],"tags":["apps-engine","parameter-validation","room"],"backgroundTag":"missing-required-argument","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"}