RocketChat/Rocket.Chat · error · Meteor.Error

error-not-allowed

error-not-allowed

Error message

Not allowed

What it means

Thrown by saveRoomName when roomCoordinator.getRoomDirectives(room.t).preventRenaming() returns true (saveRoomName.ts:59). Room-type server directives decide per type whether renaming is allowed; the default registered in roomCoordinator.ts:30 returns false, and no core type overrides it — so in practice this fires only for room types registered (often by enterprise/custom code via roomCoordinator.add) with preventRenaming: () => true. Code 'error-not-allowed', details { function: 'RocketChat.saveRoomdisplayName' }.

Source

Thrown at apps/meteor/server/lib/rooms/settings/saveRoomName.ts:59

	return responses;
};

export async function saveRoomName(
	rid: string,
	displayName: string | undefined,
	user: IUser,
	sendMessage = true,
): Promise<string | undefined> {
	const room = await Rooms.findOneById(rid);
	if (!room) {
		throw new Meteor.Error('error-invalid-room', 'Invalid room', {
			function: 'RocketChat.saveRoomdisplayName',
		});
	}

	if (roomCoordinator.getRoomDirectives(room.t).preventRenaming()) {
		throw new Meteor.Error('error-not-allowed', 'Not allowed', {
			function: 'RocketChat.saveRoomdisplayName',
		});
	}

	await Room.beforeNameChange(room);

	if (isRoomNativeFederated(room)) {
		displayName = `${displayName}:${room.federation.mrid.split(':').pop()}`;
	}

	if (displayName === room.name) {
		return;
	}

	if (!displayName?.trim()) {
		return;
	}

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Identify the room type (room.t) and its registration — find the roomCoordinator.add call that sets preventRenaming for it
  2. Do not offer/attempt renames for that type; hide the name field using the same directive in UI logic
  3. If renaming should be allowed, change the directive to return false (or omit it so the default applies)
  4. If you own a custom room type, document that names are immutable for consumers

Example fix

// before (custom room type locks renaming, caller renames anyway)
await saveRoomName(rid, newName, user);

// after
const room = await Rooms.findOneById(rid);
if (roomCoordinator.getRoomDirectives(room.t).preventRenaming()) {
	throw new Meteor.Error('error-not-allowed', 'This room type cannot be renamed');
}
await saveRoomName(rid, newName, user);
Defensive patterns

Strategy: validation

Validate before calling

const room = await Rooms.findOneById(rid);
if (!room) throw new Meteor.Error('error-invalid-room', 'Invalid room');
if (roomCoordinator.getRoomDirectives(room.t).preventRenaming()) {
	throw new Meteor.Error('error-not-allowed', `Rooms of type '${room.t}' cannot be renamed`);
}
await saveRoomName(rid, displayName, user);

Try / catch

try {
	await saveRoomName(rid, displayName, user);
} catch (e) {
	if (e instanceof Meteor.Error && e.error === 'error-not-allowed') {
		// room type locks its name: hide/disable the rename affordance for this type
	}
}

Prevention

When it happens

Trigger: Calling saveRoomName on a room whose type was registered with a preventRenaming directive (e.g. certain managed/custom room types); EE/custom room-type plugins that lock their rooms' names; generic settings UI that shows the name field for every room type including locked ones.

Common situations: Enterprise deployments with custom room types whose names are system-managed; apps creating rooms of a locked type then trying to rename them; settings screens that do not consult allowRoomSettingChange/preventRenaming before enabling the field.

Related errors


AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18). Data as JSON: /api/errors/269779c9cb5af8dc. Report an issue: GitHub.