RocketChat/Rocket.Chat · error · FederationMatrixInvalidConfigurationError
Federation configuration is invalid,unable to change room ow
Error message
Federation configuration is invalid,unable to change room owners
What it means
Thrown by addRoomOwner() in apps/meteor/server/meteor-methods/rooms/addRoomOwner.ts:44 as FederationMatrixInvalidConfigurationError('unable to change room owners') — a plain Error subclass (apps/meteor/server/services/federation/utils.ts:13) whose message becomes 'Federation configuration is invalid,unable to change room owners'. It fires when the room is federated (isRoomFederated(room) === true, bypassing the permission check) but the Federation_Service_Enabled setting is false, so the server cannot perform the Matrix-side ownership change.
Source
Thrown at apps/meteor/server/meteor-methods/rooms/addRoomOwner.ts:44
check(userId, String);
const room = await Rooms.findOneById(rid, { projection: { t: 1, federated: 1, federation: 1 } });
if (!room) {
throw new Meteor.Error('error-invalid-room', 'Invalid room', {
method: 'addRoomOwner',
});
}
const isFederated = isRoomFederated(room);
if (!(await hasPermissionAsync(fromUserId, 'set-owner', rid)) && !isFederated) {
throw new Meteor.Error('error-not-allowed', 'Not allowed', {
method: 'addRoomOwner',
});
}
if (isFederated && !isFederationEnabled()) {
throw new FederationMatrixInvalidConfigurationError('unable to change room owners');
}
const user = await Users.findOneById(userId);
if (!user?.username) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', {
method: 'addRoomOwner',
});
}
const subscription = await Subscriptions.findOneByRoomIdAndUserId(rid, user._id);
if (!subscription) {
throw new Meteor.Error('error-user-not-in-room', 'User is not in this room', {
method: 'addRoomOwner',
});
}
View on GitHub (pinned to b2c16d5842)
Solutions
- Re-enable federation: set Federation_Service_Enabled to true in Administration > Federation (or settings.get('Federation_Service_Enabled')).
- If the room should no longer be federated, use the supported un-federation/migration flow to clear its federation state before changing owners.
- Guard the call: if (isRoomFederated(room) && !settings.get('Federation_Service_Enabled')) skip or surface a configuration error to the operator.
- If federation is intentionally off workspace-wide, audit for stray federated rooms (rooms with federation/federated markers) and clean them up.
Example fix
// before
await addRoomOwner(uid, rid, targetUserId); // throws on federated room with federation off
// after
const federationEnabled = settings.get<boolean>('Federation_Service_Enabled');
if (!federationEnabled) throw new Error('enable Federation_Service_Enabled before changing owners of federated rooms');
await addRoomOwner(uid, rid, targetUserId); Defensive patterns
Strategy: try-catch
Validate before calling
import { isFederationEnabled } from '<server>/services/federation/utils';
if (!isFederationEnabled()) {
// changing owners of federated rooms will throw
throw new Error('enable federation before managing federated room owners');
} Try / catch
try {
await addRoomOwner(uid, rid, userId);
} catch (e) {
if (e instanceof Error && e.name === 'FederationMatrixInvalidConfiguration') {
// configuration problem, not a code problem: check Federation_Service_Enabled
}
} Prevention
- Monitor the Federation_Service_Enabled setting and alert when it flips while federated rooms exist.
- Guard owner-change flows on federated rooms with an explicit settings check.
- Treat e.name === 'FederationMatrixInvalidConfiguration' as an ops/config error class in your handler.
When it happens
Trigger: Calling addRoomOwner on a room whose federation fields mark it as federated while the workspace has federation disabled in Administration > Federation (Federation_Service_Enabled = false); federation was enabled when the room was created and later turned off; importing/migrating federated rooms into a workspace where the Federation service was never configured.
Common situations: Disabling federation after federated rooms exist and then trying to manage their owners; test environments cloning federated room documents without the federation service; partial federation setup where the app flag is on but the server setting is off.
Related errors
- error-invalid-configuration
- Federation configuration is invalid,unable to change room ow
- error-not-authorized-federation
- error-invalid-room
- error-push-disabled
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/e3423eaa0bf54e13.
Report an issue: GitHub.