RocketChat/Rocket.Chat · error · Error
We should have at least one existing role to create the user
Error message
We should have at least one existing role to create the user: ${normalizedRoleNamesOrIds.join(', ')} What it means
Error "We should have at least one existing role to create the user: ${normalizedRoleNamesOrIds.join(', ')}" thrown in RocketChat/Rocket.Chat.
Source
Thrown at apps/meteor/server/lib/saml/lib/SAML.ts:49
};
const convertRoleNamesToIds = async (roleNamesOrIds: string[]): Promise<IRole['_id'][]> => {
const normalizedRoleNamesOrIds = roleNamesOrIds.map((role) => role.trim()).filter((role) => role.length > 0);
if (!normalizedRoleNamesOrIds.length) {
throw new Error(`No valid role names or ids provided for conversion: ${roleNamesOrIds.join(', ')}`);
}
const roles = (await Roles.findInIdsOrNames(normalizedRoleNamesOrIds).toArray()).map((role) => role._id);
if (roles.length !== normalizedRoleNamesOrIds.length) {
SystemLogger.warn({
msg: 'Failed to convert some role names to ids',
roles: normalizedRoleNamesOrIds,
});
}
if (!roles.length) {
throw new Error(`We should have at least one existing role to create the user: ${normalizedRoleNamesOrIds.join(', ')}`);
}
return roles;
};
export class SAML {
public static async processRequest(
req: IIncomingMessage,
res: ServerResponse,
service: IServiceProviderOptions,
samlObject: ISAMLAction,
): Promise<void> {
// Skip everything if there's no service set by the saml middleware
if (!service) {
if (samlObject.actionName === 'metadata') {
showErrorMessage(res, `Unexpected SAML service ${samlObject.serviceName}`);
return;
}View on GitHub (pinned to 2a7de45707)
Solutions
- Ensure at least one of the mapped SAML roles already exists on the server; create the role or fix the role mapping configuration.
When it happens
Trigger: Thrown during SAML user provisioning when none of the mapped roles exist in the server, so the new user would have no role.
Common situations: See trigger scenarios.
AI-assisted analysis of RocketChat/Rocket.Chat@2a7de45707 (2026-08-18).
Data as JSON: /api/errors/6249f8d67661398e.
Report an issue: GitHub.