{"record":{"id":"28f600a902e44106","repo":"RocketChat/Rocket.Chat","slug":"federation-configuration-is-invalid-unable-to-chan","errorCode":null,"errorMessage":"Federation configuration is invalid,unable to change room owners","messagePattern":"Federation configuration is invalid,unable to change room owners","errorType":"exception","errorClass":"FederationMatrixInvalidConfigurationError","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/meteor-methods/rooms/addRoomModerator.ts","lineNumber":44,"sourceCode":"\tcheck(userId, String);\n\n\tconst room = await Rooms.findOneById(rid, { projection: { t: 1, federated: 1, federation: 1 } });\n\tif (!room) {\n\t\tthrow new Meteor.Error('error-invalid-room', 'Invalid room', {\n\t\t\tmethod: 'addRoomModerator',\n\t\t});\n\t}\n\n\tconst isFederated = isRoomFederated(room);\n\n\tif (!(await hasPermissionAsync(fromUserId, 'set-moderator', rid)) && !isFederated) {\n\t\tthrow new Meteor.Error('error-not-allowed', 'Not allowed', {\n\t\t\tmethod: 'addRoomModerator',\n\t\t});\n\t}\n\n\tif (isFederated && !isFederationEnabled()) {\n\t\tthrow new FederationMatrixInvalidConfigurationError('unable to change room owners');\n\t}\n\n\tconst user = await Users.findOneById(userId);\n\n\tif (!user?.username) {\n\t\tthrow new Meteor.Error('error-invalid-user', 'Invalid user', {\n\t\t\tmethod: 'addRoomModerator',\n\t\t});\n\t}\n\n\tconst subscription = await Subscriptions.findOneByRoomIdAndUserId(rid, user._id);\n\n\tif (!subscription) {\n\t\tthrow new Meteor.Error('error-user-not-in-room', 'User is not in this room', {\n\t\t\tmethod: 'addRoomModerator',\n\t\t});\n\t}\n","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/meteor-methods/rooms/addRoomModerator.ts#L26-L62","documentation":"When the room IS federated but the Federation_Service_Enabled setting is off, addRoomModerator throws FederationMatrixInvalidConfigurationError with the message 'Federation configuration is invalid, unable to change room owners'. This is a plain Error subclass (name 'FederationMatrixInvalidConfiguration'), not a Meteor.Error, so over DDP it surfaces as a generic method failure rather than a coded error. It means the workspace retains federated rooms while the Matrix-based federation service is disabled or never configured.","triggerScenarios":"Calling addRoomModerator on a room flagged federated/federation while settings.get('Federation_Service_Enabled') is false - e.g. federation was enabled, rooms were federated, then the service was switched off.","commonSituations":"Federation toggled off after pilot use; deployments where federation was never fully set up but federated rooms exist from an import/migration; version upgrades changing federation defaults.","solutions":["If federation is intended, enable Federation_Service_Enabled and complete the Matrix bridge configuration.","If federation is permanently off, convert or remove the leftover federated rooms before managing their roles.","Check the room's federated/federation flags (rooms.info) when this error appears unexpectedly."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// preflight: only attempt role changes on federated rooms when federation is on\nconst info = await fetch('/api/v1/settings/Federation_Service_Enabled', { headers }).then((r) => r.json());\nif (roomIsFederated && info.value !== true) {\n\tthrow new Error('Federation disabled but room is federated - fix configuration first');\n}","typeGuard":null,"tryCatchPattern":"try {\n\tawait Meteor.callAsync('addRoomModerator', rid, userId);\n} catch (e: any) {\n\tif (e?.message?.includes('Federation configuration is invalid')) {\n\t\t// config-level failure: enable federation or unfederate the room; do not retry\n\t}\n}","preventionTips":["Keep Federation_Service_Enabled consistent with the presence of federated rooms.","When decommissioning federation, convert or remove federated rooms as part of the runbook.","Check the room's federated/federation flags before scripting role changes."],"tags":["federation","settings","rooms","roles","meteor-methods"],"backgroundTag":"federation-misconfiguration","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}