{"record":{"id":"63649e684a28fa45","repo":"RocketChat/Rocket.Chat","slug":"error-no-owner-channel","errorCode":null,"errorMessage":"error-no-owner-channel","messagePattern":"error-no-owner-channel","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/services/team/service.ts","lineNumber":356,"sourceCode":"\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);\n\t\t\tif (!canSeeRoom) {\n\t\t\t\tthrow new Error('invalid-room');\n\t\t\t}\n\t\t}\n\n\t\tfor await (const room of validRooms) {\n\t\t\tif (room.teamId) {\n\t\t\t\tthrow new Error('room-already-on-team');\n\t\t\t}\n\n\t\t\tif (!(await Subscriptions.isUserInRole(uid, 'owner', room._id))) {\n\t\t\t\tthrow new Error('error-no-owner-channel');\n\t\t\t}\n\n\t\t\tif (room.t === 'c') {\n\t\t\t\tawait Message.saveSystemMessage('user-added-room-to-team', team.roomId, room.name || '', user);\n\t\t\t}\n\n\t\t\troom.teamId = teamId;\n\t\t}\n\n\t\tawait Rooms.setTeamByIds(rids, teamId);\n\t\tvoid notifyOnRoomChangedById(rids, 'updated');\n\t\treturn validRooms;\n\t}\n\n\tasync removeRoom(uid: string, rid: string, teamId: string, canRemoveAnyRoom = false): Promise<IRoom> {\n\t\tif (!teamId) {\n\t\t\tthrow new Error('missing-teamId');\n\t\t}","sourceCodeStart":338,"sourceCodeEnd":374,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/e4b8178b205510181a96ceefee043d0abcd13e5a/apps/meteor/server/services/team/service.ts#L338-L374","documentation":"Error \"error-no-owner-channel\" thrown in RocketChat/Rocket.Chat.","triggerScenarios":"Thrown at apps/meteor/server/services/team/service.ts:354 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Make the acting user an owner of the room before adding it to the team.","Assign the owner role to the user in the room via the members management UI or API."],"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"}