RocketChat/Rocket.Chat · error · MeteorError
error-username-reserved-by-bridge
error-username-reserved-by-bridge
Error message
Name is reserved by a federation bridge
What it means
Thrown by the checkUsernameAvailability callback (priority HIGH, 'federation-bridge-namespace') when a requested username or room/team name falls inside a Matrix appservice bridge's exclusive namespace. Exclusive namespaces may only be owned by the bridge (e.g. a WhatsApp/Slack bridge owning @whatsapp_*:server.com), so regular users cannot register or rename into them. The check is inert when federation is not configured (no serverName / no appservice registrations loaded).
Solutions
- Choose a username/room name outside the bridge's reserved pattern (check the appservice registration's exclusive namespace regexes)
- If the collision is a false positive, tighten the bridge's namespace regex in its appservice registration
- If the name genuinely belongs to that service, provision it through the bridge itself rather than as a regular user
Example fix
// before: registering a name and getting error-username-reserved-by-ridge from the callback
await setUsername(userId, '_bridge_alice');
// after: test the same reservation rule first
import { isReservedByExclusiveBridge } from '@rocket.chat/federation-matrix';
if (isReservedByExclusiveBridge('user', '_bridge_alice')) {
throw new Error('Pick a name outside the bridge namespace');
}
await setUsername(userId, '_bridge_alice'); Defensive patterns
Strategy: validation
Validate before calling
import { isReservedByExclusiveBridge } from '@rocket.chat/federation-matrix';
const isHandleAvailable = (type: 'user' | 'room', name: string): boolean =>
!isReservedByExclusiveBridge(type, name); Try / catch
try {
await setUsername(userId, name);
} catch (err: any) {
if (err?.error === 'error-username-reserved-by-bridge') {
// prompt for a different name outside the bridge namespace
}
throw err;
} Prevention
- Check bridge-exclusive namespaces in username suggestion/validation UIs
- Keep appservice namespace regexes narrow so common names are not over-reserved
- Remember the check is case-insensitive (lowercased localpart is also tested)
When it happens
Trigger: Registering or renaming a user whose username matches an exclusive 'users' namespace regex; creating/renaming a room or team whose name matches the bridge's 'aliases'/'rooms' namespaces; names are also tested lowercased because Matrix localparts are lowercase-conventioned.
Common situations: Bridges (Element/Matrix appservices) installed with broad exclusive namespace regexes like @_bridge_.*; users picking nicknames that collide with the bridge prefix; renaming teams into a reserved alias pattern.
Related errors
- Edit_Federated_User_Not_Allowed
- error-cannot-delete-federated-room
- error-creator-not-in-room
- error-federated-users-in-non-federated-rooms
- error-federated-users-in-non-federated-rooms
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/cb5c813d8d6ba7d2.
Report an issue: GitHub.
Appendix: source
Thrown at apps/meteor/ee/server/hooks/federation/index.ts:393
return;
}
if ('name' in userUpdated && userUpdated.name !== oldUserData.name) {
void FederationMatrix.updateUserName(userUpdated);
}
});
// Reserve handles that fall within a bridge's exclusive namespace, so a regular user cannot
// register or rename into a localpart only the bridge is allowed to own. Usernames are checked
// against the bridge's exclusive `users` namespace; room/team names against its `aliases`/`rooms`
// namespaces. Inert when federation is disabled (the helper matches against loaded appservice
// registrations, of which there are none). Every handle assignment path — user creation,
// SSO/LDAP assignment and renames, plus room renames and team creation — funnels through
// `checkUsernameAvailability`.
checkUsernameAvailabilityCallback.add(
(name, type) => {
if (isReservedByExclusiveBridge(type, name)) {
throw new MeteorError('error-username-reserved-by-bridge', 'Name is reserved by a federation bridge');
}
},
callbacks.priority.HIGH,
'federation-bridge-namespace',
);
View on GitHub (pinned to b2c16d5842)