{"record":{"id":"08766d22dcc8fa80","repo":"RocketChat/Rocket.Chat","slug":"error-not-authorized-federation-08766d","errorCode":"error-not-authorized-federation","errorMessage":"Not authorized to access federation","messagePattern":"Not authorized to access federation","errorType":"error_code","errorClass":"MeteorError","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/services/room/service.ts","lineNumber":202,"sourceCode":"\tasync join({ room, user, joinCode }: { room: IRoom; user: IUser; joinCode?: string }) {\n\t\tif (!(await roomCoordinator.getRoomDirectives(room.t)?.allowMemberAction(room, RoomMemberActions.JOIN, user._id))) {\n\t\t\tthrow new MeteorError('error-not-allowed', 'Not allowed', { method: 'joinRoom' });\n\t\t}\n\n\t\tif (isOmnichannelRoom(room) && !room.open) {\n\t\t\tthrow new MeteorError('room-closed', 'Room is closed', { method: 'joinRoom' });\n\t\t}\n\n\t\tif (!(await Authorization.canAccessRoom(room, user))) {\n\t\t\tthrow new MeteorError('error-not-allowed', 'Not allowed', { method: 'joinRoom' });\n\t\t}\n\n\t\tif (\n\t\t\tFederationActions.shouldPerformFederationAction(room) &&\n\t\t\t!isUserNativeFederated(user) &&\n\t\t\t!(await FederationMatrix.canUserAccessFederation(user))\n\t\t) {\n\t\t\tthrow new MeteorError('error-not-authorized-federation', 'Not authorized to access federation', { method: 'joinRoom' });\n\t\t}\n\n\t\tif (isRoomWithJoinCode(room) && !(await Authorization.hasPermission(user._id, 'join-without-join-code'))) {\n\t\t\tif (!joinCode) {\n\t\t\t\tthrow new MeteorError('error-code-required', 'Code required', { method: 'joinRoom' });\n\t\t\t}\n\n\t\t\tconst isCorrectJoinCode = !!(await Rooms.findOneByJoinCodeAndId(joinCode, room._id, {\n\t\t\t\tprojection: { _id: 1 },\n\t\t\t}));\n\n\t\t\tif (!isCorrectJoinCode) {\n\t\t\t\tthrow new MeteorError('error-code-invalid', 'Invalid code', { method: 'joinRoom' });\n\t\t\t}\n\t\t}\n\n\t\treturn addUserToRoom(room._id, user);\n\t}","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/services/room/service.ts#L184-L220","documentation":"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.","triggerScenarios":"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.","commonSituations":"Federation rolled out to a subset of users; federation (Matrix) service not fully configured or running; users following links to federated rooms.","solutions":["Enable federation for the user / complete the federation setup in Administration, or join with a federated user account","Verify the federation service is running and ready for the room (blockIfRoomFederatedButServiceNotReady-style checks pass)","If this room should not be federated, review the room's federation flags"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { FederationActions, FederationMatrix } from '@rocket.chat/core-federation';\n\nconst needsFederation = FederationActions.shouldPerformFederationAction(room);\nconst canFederate = !needsFederation || isUserNativeFederated(user) || (await FederationMatrix.canUserAccessFederation(user));\nif (!canFederate) {\n  // do not call join(): the user is not allowed into federated rooms yet\n  return notifyUser('Federation access is required for this room');\n}","typeGuard":"const userMayJoinFederatedRoom = async (room: IRoom, user: IUser): Promise<boolean> =>\n  !FederationActions.shouldPerformFederationAction(room) ||\n  isUserNativeFederated(user) ||\n  (await FederationMatrix.canUserAccessFederation(user));","tryCatchPattern":"try {\n  await roomService.join({ room, user });\n} catch (err) {\n  if (err?.error === 'error-not-authorized-federation') {\n    // not retryable until federation is enabled for this user or workspace\n    return notifyUser('Ask your admin to enable federation access for your account');\n  }\n  throw err;\n}","preventionTips":["Gate federated room joins behind a federation-enabled check in the UI","Complete federation setup before sharing federated room links with local users","Treat this as a configuration issue, not a transient failure — do not retry"],"tags":["federation","rooms","join","matrix","rocket-chat"],"backgroundTag":"federation-access-denied","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}