{"record":{"id":"18ff612ff21df9b1","repo":"RocketChat/Rocket.Chat","slug":"error-not-allowed-18ff61","errorCode":"error-not-allowed","errorMessage":"Not allowed","messagePattern":"Not allowed","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/lib/eraseRoom.ts","lineNumber":31,"sourceCode":"\n\tif (!room) {\n\t\tthrow new Meteor.Error('error-invalid-room', 'Invalid room', {\n\t\t\tmethod: 'eraseRoom',\n\t\t});\n\t}\n\n\tif (room.federated) {\n\t\tthrow new Meteor.Error('error-cannot-delete-federated-room', 'Cannot delete federated room', {\n\t\t\tmethod: 'eraseRoom',\n\t\t});\n\t}\n\n\tif (\n\t\t!(await roomCoordinator\n\t\t\t.getRoomDirectives(room.t)\n\t\t\t?.canBeDeleted((permissionId, rid) => hasPermissionAsync(user, permissionId, rid), room))\n\t) {\n\t\tthrow new Meteor.Error('error-not-allowed', 'Not allowed', {\n\t\t\tmethod: 'eraseRoom',\n\t\t});\n\t}\n\n\tconst team = room.teamId && (await Team.getOneById(room.teamId, { projection: { roomId: 1 } }));\n\tif (team && !(await hasPermissionAsync(user, `delete-team-${room.t === 'c' ? 'channel' : 'group'}`, team.roomId))) {\n\t\tthrow new Meteor.Error('error-not-allowed', 'Not allowed', {\n\t\t\tmethod: 'eraseRoom',\n\t\t});\n\t}\n\n\tif (Apps.self?.isLoaded()) {\n\t\tconst prevent = await Apps.self?.triggerEvent(AppEvents.IPreRoomDeletePrevent, room);\n\t\tif (prevent) {\n\t\t\tthrow new Meteor.Error('error-app-prevented-deleting', 'A Rocket.Chat App prevented the room erasing.');\n\t\t}\n\t}\n","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/lib/eraseRoom.ts#L13-L49","documentation":"The room-type directive's canBeDeleted check failed: the acting user does not hold the permission the room type requires for deletion (for example delete-c for public channels, delete-p for private groups) in the context of that room. This is a permission denial, not a missing room.","triggerScenarios":"eraseRoom is called by a user whose roles lack the room-type delete permission, or whose permission is scoped away from that specific room.","commonSituations":"Moderator-style roles granted other room rights but not delete-*; permissions scoped per room via role-scoping; custom role trees after an upgrade.","solutions":["Grant the acting role the appropriate delete permission (delete-c / delete-p / the room type's equivalent) in Administration > Permissions","Or perform the deletion with a user/role that already holds it (e.g. admin)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const canDelete = await roomCoordinator\n  .getRoomDirectives(room.t)\n  ?.canBeDeleted((permissionId, rid) => hasPermissionAsync(user, permissionId, rid), room);\nif (!canDelete) {\n  // user lacks the room-type delete permission: hide the delete action\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Gate destructive UI on the same canBeDeleted check the server uses","Audit role permission trees so delete permissions are granted deliberately"],"tags":["rooms","permissions","deletion","authorization"],"backgroundTag":"permission-denied","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}