{"record":{"id":"60882c846ea04b45","repo":"RocketChat/Rocket.Chat","slug":"you-have-been-muted","errorCode":null,"errorMessage":"You_have_been_muted","messagePattern":"You_have_been_muted","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/meteor/server/lib/authorization/canSendMessage.ts","lineNumber":50,"sourceCode":"\n\tif (\n\t\tawait roomCoordinator.getRoomDirectives(room.t).allowMemberAction(room, RoomMemberActions.BLOCK, 'uid' in args ? args.uid : args._id)\n\t) {\n\t\tconst subscription = await Subscriptions.findOneByRoomIdAndUserId(room._id, 'uid' in args ? args.uid : args._id, subscriptionOptions);\n\t\tif (subscription && (subscription.blocked || subscription.blocker)) {\n\t\t\tthrow new Error('room_is_blocked');\n\t\t}\n\t}\n\n\tif (room.ro === true && !(await hasPermissionAsync('uid' in args ? args.uid : args._id, 'post-readonly', room._id))) {\n\t\t// Unless the user was manually unmuted\n\t\tif (args.username && !(room.unmuted || []).includes(args.username)) {\n\t\t\tthrow new Error(\"You can't send messages because the room is readonly.\");\n\t\t}\n\t}\n\n\tif (args.username && room?.muted?.includes(args.username)) {\n\t\tthrow new Error('You_have_been_muted');\n\t}\n}\n// TODO: remove option uid and username and type\nexport async function canSendMessageAsync(\n\trid: IRoom['_id'],\n\tuser: { uid: IUser['_id']; username: IUser['username']; type: IUser['type'] } | IUser,\n\textraData?: Record<string, any>,\n): Promise<IRoom> {\n\tconst room = await Rooms.findOneById(rid);\n\tif (!room) {\n\t\tthrow new Error('error-invalid-room');\n\t}\n\n\tawait validateRoomMessagePermissionsAsync(room, user, extraData);\n\treturn room;\n}\n","sourceCodeStart":32,"sourceCodeEnd":67,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/lib/authorization/canSendMessage.ts#L32-L67","documentation":"validateRoomMessagePermissionsAsync throws You_have_been_muted (plain Error) when the acting username appears in room.muted — the room-level mute list set by moderators. Unlike read-only (a whole-room state) this silences one user in that room, and the room.unmuted list does not lift it.","triggerScenarios":"A muted user (or an integration acting as them) sends any message to the room where a moderator muted them via the user card or moderation tools.","commonSituations":"Moderators mute spammers and the spam client keeps posting; users muted during town-hall meetings; a stale mute list nobody remembers to clear.","solutions":["A moderator unmutes the user (removes the username from room.muted)","Before sending programmatically, check room.muted for the acting username and surface a 'muted in this channel' state","Prefer time-boxed muting over permanent mutes for temporary silencing"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (room.muted?.includes(username)) {\n  // show 'you are muted in this channel' and block the send locally\n}","typeGuard":"const isMutedInRoom = (room: { muted?: string[] }, username: string): boolean =>\n  room.muted?.includes(username) === true;","tryCatchPattern":"try {\n  await sendMessage(...);\n} catch (e) {\n  if (e instanceof Error && e.message === 'You_have_been_muted') {\n    // muted by moderation: no retry; surface muted state in the composer\n  }\n  throw e;\n}","preventionTips":["Reflect room.muted in the client composer state","Use time-boxed mutes for temporary silence instead of permanent ones","Review mute lists during channel moderation audits"],"tags":["authorization","messages","moderation","muted"],"backgroundTag":"user-muted-in-room","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}