RocketChat/Rocket.Chat · error · MeteorError

error-not-authorized-federation

error-not-authorized-federation

Error message

Not authorized to access federation

What it means

In join(), when FederationActions.shouldPerformFederationAction(room) is true (the room is federated), the user is not a native federated user, and FederationMatrix.canUserAccessFederation(user) is false, the join is rejected with Meteor error-not-authorized-federation ('Not authorized to access federation', method 'joinRoom'). Local, non-federated users are gated out of federated rooms.

Source

Thrown at apps/meteor/server/services/room/service.ts:202

	async join({ room, user, joinCode }: { room: IRoom; user: IUser; joinCode?: string }) {
		if (!(await roomCoordinator.getRoomDirectives(room.t)?.allowMemberAction(room, RoomMemberActions.JOIN, user._id))) {
			throw new MeteorError('error-not-allowed', 'Not allowed', { method: 'joinRoom' });
		}

		if (isOmnichannelRoom(room) && !room.open) {
			throw new MeteorError('room-closed', 'Room is closed', { method: 'joinRoom' });
		}

		if (!(await Authorization.canAccessRoom(room, user))) {
			throw new MeteorError('error-not-allowed', 'Not allowed', { method: 'joinRoom' });
		}

		if (
			FederationActions.shouldPerformFederationAction(room) &&
			!isUserNativeFederated(user) &&
			!(await FederationMatrix.canUserAccessFederation(user))
		) {
			throw new MeteorError('error-not-authorized-federation', 'Not authorized to access federation', { method: 'joinRoom' });
		}

		if (isRoomWithJoinCode(room) && !(await Authorization.hasPermission(user._id, 'join-without-join-code'))) {
			if (!joinCode) {
				throw new MeteorError('error-code-required', 'Code required', { method: 'joinRoom' });
			}

			const isCorrectJoinCode = !!(await Rooms.findOneByJoinCodeAndId(joinCode, room._id, {
				projection: { _id: 1 },
			}));

			if (!isCorrectJoinCode) {
				throw new MeteorError('error-code-invalid', 'Invalid code', { method: 'joinRoom' });
			}
		}

		return addUserToRoom(room._id, user);
	}

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Enable federation for the user / complete the federation setup in Administration, or join with a federated user account
  2. Verify the federation service is running and ready for the room (blockIfRoomFederatedButServiceNotReady-style checks pass)
  3. If this room should not be federated, review the room's federation flags
Defensive patterns

Strategy: validation

Validate before calling

import { FederationActions, FederationMatrix } from '@rocket.chat/core-federation';

const needsFederation = FederationActions.shouldPerformFederationAction(room);
const canFederate = !needsFederation || isUserNativeFederated(user) || (await FederationMatrix.canUserAccessFederation(user));
if (!canFederate) {
  // do not call join(): the user is not allowed into federated rooms yet
  return notifyUser('Federation access is required for this room');
}

Type guard

const userMayJoinFederatedRoom = async (room: IRoom, user: IUser): Promise<boolean> =>
  !FederationActions.shouldPerformFederationAction(room) ||
  isUserNativeFederated(user) ||
  (await FederationMatrix.canUserAccessFederation(user));

Try / catch

try {
  await roomService.join({ room, user });
} catch (err) {
  if (err?.error === 'error-not-authorized-federation') {
    // not retryable until federation is enabled for this user or workspace
    return notifyUser('Ask your admin to enable federation access for your account');
  }
  throw err;
}

Prevention

When it happens

Trigger: A local (non-federated) user joining a federated room while federation access is not granted to them — federation disabled or limited workspace-wide, or the user not enabled for federation.

Common situations: Federation rolled out to a subset of users; federation (Matrix) service not fully configured or running; users following links to federated rooms.

Related errors


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