{"record":{"id":"a619dc6b49691322","repo":"RocketChat/Rocket.Chat","slug":"error-not-authorized-federation-a619dc","errorCode":"error-not-authorized-federation","errorMessage":"Not authorized to access federation","messagePattern":"Not authorized to access federation","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/lib/rooms/createRoom.ts","lineNumber":186,"sourceCode":"\t\tthrow new Meteor.Error('error-federated-users-in-non-federated-rooms', 'Cannot add federated users to non-federated rooms', {\n\t\t\tmethod: 'createRoom',\n\t\t});\n\t}\n\n\tawait prepareCreateRoomCallback.run({\n\t\ttype,\n\t\t// name,\n\t\t// owner: ownerUsername,\n\t\t// members,\n\t\t// readOnly,\n\t\textraData,\n\t\t// options,\n\t});\n\n\tconst shouldBeHandledByFederation = extraData.federated === true;\n\n\tif (shouldBeHandledByFederation && owner && !isUserNativeFederated(owner) && !(await FederationMatrix.canUserAccessFederation(owner))) {\n\t\tthrow new Meteor.Error('error-not-authorized-federation', 'Not authorized to access federation', {\n\t\t\tmethod: 'createRoom',\n\t\t});\n\t}\n\n\tif (type === 'd') {\n\t\treturn createDirectRoom(members as IUser[], extraData, { ...options, creator: options?.creator || owner?._id });\n\t}\n\n\tconst memberList = [...members];\n\n\tif (!onlyUsernames(memberList)) {\n\t\tthrow new Meteor.Error(\n\t\t\t'error-invalid-members',\n\t\t\t'members should be an array of usernames if provided for rooms other than direct messages',\n\t\t);\n\t}\n\n\tif (!isValidName(name)) {","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/lib/rooms/createRoom.ts#L168-L204","documentation":"When a room is marked federated (extraData.federated === true) the creating owner must either be a native federated user or pass FederationMatrix.canUserAccessFederation. Otherwise createRoom throws error-not-authorized-federation, blocking local users without federation access from creating federated rooms.","triggerScenarios":"createRoom with extraData.federated = true where owner is a normal local user (not isUserNativeFederated) and canUserAccessFederation(owner) resolves false — e.g. federation disabled in admin settings, user not allowed by federation ACLs, or the Matrix bridge not running.","commonSituations":"Federation toggle enabled at room level but the federation feature itself disabled or not fully configured server-side; attempting to create federated rooms with a bot/admin account that was never granted federation access; development environments without the federation app installed.","solutions":["Verify federation is enabled and healthy in Administration settings (Federation / Matrix bridge running)","Ensure the owner user is a native federated user or is permitted by canUserAccessFederation (check federation access rules)","If federation is not intended, remove federated: true from roomExtraData"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (extraData.federated === true && !isUserNativeFederated(owner)) {\n  const allowed = await FederationMatrix.canUserAccessFederation(owner);\n  if (!allowed) {\n    throw new Meteor.Error('error-not-authorized-federation', 'Owner lacks federation access');\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await createRoom(type, name, owner, members, { federated: true });\n} catch (err) {\n  if (err instanceof Meteor.Error && err.error === 'error-not-authorized-federation') {\n    // surface to the user: enable federation or use a federated-capable owner\n  }\n  throw err;\n}","preventionTips":["Gate federated room creation UI behind a federation-access check","Monitor canUserAccessFederation results for owners used by automations","Keep federation settings verified in CI for workspaces that use it"],"tags":["federation","authorization","room-creation","matrix"],"backgroundTag":"feature-not-authorized","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}