RocketChat/Rocket.Chat · error · Error
No valid role names or ids provided for conversion: ${roleNa
Error message
No valid role names or ids provided for conversion: ${roleNamesOrIds.join(', ')} What it means
Error "No valid role names or ids provided for conversion: ${roleNamesOrIds.join(', ')}" thrown in RocketChat/Rocket.Chat.
Source
Thrown at apps/meteor/server/lib/saml/lib/SAML.ts:36
import { createRoom } from '../../rooms/createRoom';
import { generateUsernameSuggestion } from '../../users/getUsernameSuggestion';
import { saveUserIdentity } from '../../users/saveUserIdentity';
import type { ISAMLAction } from '../definition/ISAMLAction';
import type { ISAMLUser } from '../definition/ISAMLUser';
import type { IServiceProviderOptions } from '../definition/IServiceProviderOptions';
const showErrorMessage = function (res: ServerResponse, err: string): void {
res.writeHead(200, {
'Content-Type': 'text/html',
});
const content = `<html><body><h2>Sorry, an annoying error occured</h2><div>${escapeHTML(err)}</div></body></html>`;
res.end(content, 'utf-8');
};
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;
};
View on GitHub (pinned to 2a7de45707)
Solutions
- Configure the SAML role mapping with at least one valid role name or id; check the role sync settings in the SAML admin panel.
When it happens
Trigger: Thrown during SAML role sync when the role mapping settings yield no valid role names or ids to convert.
Common situations: See trigger scenarios.
AI-assisted analysis of RocketChat/Rocket.Chat@2a7de45707 (2026-08-18).
Data as JSON: /api/errors/9fef196c74063c85.
Report an issue: GitHub.