{"record":{"id":"b853b30bc4e88272","repo":"RocketChat/Rocket.Chat","slug":"invalid-team","errorCode":null,"errorMessage":"invalid-team","messagePattern":"invalid-team","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/services/team/service.ts","lineNumber":326,"sourceCode":"\n\tasync listByIds(ids: Array<string>, options?: FindOptions<ITeam>): Promise<ITeam[]> {\n\t\treturn Team.findByIds(ids, options).toArray();\n\t}\n\n\tasync addRooms(uid: string, rooms: Array<string>, teamId: string): Promise<Array<IRoom>> {\n\t\tif (!teamId) {\n\t\t\tthrow new Error('missing-teamId');\n\t\t}\n\t\tif (!rooms) {\n\t\t\tthrow new Error('missing-rooms');\n\t\t}\n\t\tif (!uid) {\n\t\t\tthrow new Error('missing-userId');\n\t\t}\n\n\t\tconst team = await Team.findOneById<Pick<ITeam, '_id' | 'roomId'>>(teamId, { projection: { _id: 1, roomId: 1 } });\n\t\tif (!team) {\n\t\t\tthrow new Error('invalid-team');\n\t\t}\n\n\t\t// at this point, we already checked for the permission\n\t\t// so we just need to check if the user can see the room\n\t\tconst user = await Users.findOneById(uid);\n\t\tif (!user) {\n\t\t\tthrow new Error('invalid-user');\n\t\t}\n\n\t\tconst rids = rooms.filter((rid) => rid && typeof rid === 'string');\n\t\tconst validRooms = await Rooms.findManyByRoomIds(rids).toArray();\n\t\tif (validRooms.length < rids.length) {\n\t\t\tthrow new Error('invalid-room');\n\t\t}\n\n\t\t// validate access for every room first\n\t\tfor await (const room of validRooms) {\n\t\t\tconst canSeeRoom = await Authorization.canAccessRoom(room, user);","sourceCodeStart":308,"sourceCodeEnd":344,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/e4b8178b205510181a96ceefee043d0abcd13e5a/apps/meteor/server/services/team/service.ts#L308-L344","documentation":"Error \"invalid-team\" thrown in RocketChat/Rocket.Chat.","triggerScenarios":"Thrown at apps/meteor/server/services/team/service.ts:324 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the teamId refers to an existing team; look it up via teams.info or the Teams list before calling.","Check that the team was not deleted between fetching its id and making the call."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}