RocketChat/Rocket.Chat · error · Meteor.Error
error-not-allowed
error-not-allowed
Error message
Not allowed
What it means
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.
Source
Thrown at apps/meteor/server/lib/eraseRoom.ts:31
if (!room) {
throw new Meteor.Error('error-invalid-room', 'Invalid room', {
method: 'eraseRoom',
});
}
if (room.federated) {
throw new Meteor.Error('error-cannot-delete-federated-room', 'Cannot delete federated room', {
method: 'eraseRoom',
});
}
if (
!(await roomCoordinator
.getRoomDirectives(room.t)
?.canBeDeleted((permissionId, rid) => hasPermissionAsync(user, permissionId, rid), room))
) {
throw new Meteor.Error('error-not-allowed', 'Not allowed', {
method: 'eraseRoom',
});
}
const team = room.teamId && (await Team.getOneById(room.teamId, { projection: { roomId: 1 } }));
if (team && !(await hasPermissionAsync(user, `delete-team-${room.t === 'c' ? 'channel' : 'group'}`, team.roomId))) {
throw new Meteor.Error('error-not-allowed', 'Not allowed', {
method: 'eraseRoom',
});
}
if (Apps.self?.isLoaded()) {
const prevent = await Apps.self?.triggerEvent(AppEvents.IPreRoomDeletePrevent, room);
if (prevent) {
throw new Meteor.Error('error-app-prevented-deleting', 'A Rocket.Chat App prevented the room erasing.');
}
}
View on GitHub (pinned to b2c16d5842)
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)
Defensive patterns
Strategy: validation
Validate before calling
const canDelete = await roomCoordinator
.getRoomDirectives(room.t)
?.canBeDeleted((permissionId, rid) => hasPermissionAsync(user, permissionId, rid), room);
if (!canDelete) {
// user lacks the room-type delete permission: hide the delete action
} Prevention
- Gate destructive UI on the same canBeDeleted check the server uses
- Audit role permission trees so delete permissions are granted deliberately
When it happens
Trigger: eraseRoom is called by a user whose roles lack the room-type delete permission, or whose permission is scoped away from that specific room.
Common situations: Moderator-style roles granted other room rights but not delete-*; permissions scoped per room via role-scoping; custom role trees after an upgrade.
Understand the failure class
Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.
Related errors
- error-not-authorized
- error-not-allowed
- error-not-allowed
- The required "roomId" or "roomName" param provided does not
- error-not-allowed
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/18ff612ff21df9b1.
Report an issue: GitHub.