RocketChat/Rocket.Chat · error

error-room-is-abac-managed

error-room-is-abac-managed

Error message

error-room-is-abac-managed

What it means

Thrown by the ABAC beforeAddUserToRoom hook when someone adds users to a private room (t === 'p') that has abacAttributes configured, but the workspace cannot enforce ABAC: either the ABAC_Enabled setting is false or the license lacks the 'abac' module. The hook deliberately blocks the addition (fail-closed) so an access-controlled room never silently accepts members without attribute checks. Note it throws a plain Error with this code-like message after the original hook chain ran.

Solutions

  1. Re-enable ABAC: turn on the ABAC_Enabled setting and ensure an active license that includes the abac module, then retry the add (users will then be attribute-checked).
  2. If ABAC is intentionally off, remove abacAttributes from the affected private rooms first so the guard no longer applies.
  3. License problem: restore/renew the enterprise license including ABAC, or contact sales for the correct entitlement.
  4. Do not attempt to bypass by direct DB member inserts — the room's access policy exists for a reason; clean up the room config instead.

Example fix

// before
await Meteor.callAsync('addUserToRoom', { rid, username });
// throws error-room-is-abac-managed on ABAC-configured private room

// after: ensure enforcement is on before inviting
if (room.t === 'p' && room.abacAttributes?.length) {
  await ensureSetting('ABAC_Enabled', true);
  await ensureLicenseModule('abac');
}
await Meteor.callAsync('addUserToRoom', { rid, username });
Defensive patterns

Strategy: validation

Validate before calling

// Client/server guard before adding users
import { settings } from '@rocket.chat/settings';
import { License } from '@rocket.chat/license';
function canAddToRoom(room: { t: string; abacAttributes?: string[] }): boolean {
  if (room.t !== 'p' || !room.abacAttributes?.length) return true;
  return settings.get('ABAC_Enabled') && License.hasModule('abac');
}

Type guard

function isAbacManagedPrivateRoom(room: { t: string; abacAttributes?: unknown }): room is { t: 'p'; abacAttributes: string[] } {
  return room.t === 'p' && Array.isArray(room.abacAttributes) && room.abacAttributes.length > 0;
}

Try / catch

try {
  await addUserToRoom(users, room, actor);
} catch (e) {
  if (e instanceof Error && e.message === 'error-room-is-abac-managed') {
    // fail-closed by design: fix the setting/license or strip room.abacAttributes; never bypass
  }
}

Prevention

When it happens

Trigger: addUserToRoom (direct call, REST, or UI invite) targeting a private room with non-empty abacAttributes while settings.get('ABAC_Enabled') is false OR !License.hasModule('abac'). Even a workspace admin adding themselves triggers it; the users list is only skipped when empty, the room is not private, or the room has no abacAttributes.

Common situations: ABAC was enabled once, rooms got abacAttributes, then the feature was disabled or the enterprise license (with ABAC) expired/downgraded; trial license lapsing after rooms were configured; admin toggling ABAC_Enabled off for testing while ABAC rooms exist.

Related errors


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

Appendix: source

Thrown at apps/meteor/ee/server/hooks/abac/beforeAddUserToRoom.ts:18

import { Abac } from '@rocket.chat/core-services';
import { License } from '@rocket.chat/license';

import { beforeAddUserToRoom } from '../../../../server/hooks/rooms/beforeAddUserToRoom';
import { settings } from '../../../../server/settings';

beforeAddUserToRoom.patch(async (prev, users, room, actor) => {
	await prev(users, room, actor);

	const validUsers = users.filter(Boolean);
	// No need to check ABAC when theres no users or when room is not private or when room is not ABAC managed
	if (!validUsers.length || room.t !== 'p' || !room?.abacAttributes?.length) {
		return;
	}

	// Throw error (prevent add) if ABAC is disabled (setting, license) but room is ABAC managed
	if (!settings.get('ABAC_Enabled') || !License.hasModule('abac')) {
		throw new Error('error-room-is-abac-managed');
	}

	await Abac.checkUsernamesMatchAttributes(validUsers as string[], room.abacAttributes, room);
});

View on GitHub (pinned to b2c16d5842)