{"record":{"id":"9fef196c74063c85","repo":"RocketChat/Rocket.Chat","slug":"no-valid-role-names-or-ids-provided-for-conversion","errorCode":null,"errorMessage":"No valid role names or ids provided for conversion: ${roleNamesOrIds.join(', ')}","messagePattern":"No valid role names or ids provided for conversion: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/lib/saml/lib/SAML.ts","lineNumber":36,"sourceCode":"import { createRoom } from '../../rooms/createRoom';\nimport { generateUsernameSuggestion } from '../../users/getUsernameSuggestion';\nimport { saveUserIdentity } from '../../users/saveUserIdentity';\nimport type { ISAMLAction } from '../definition/ISAMLAction';\nimport type { ISAMLUser } from '../definition/ISAMLUser';\nimport type { IServiceProviderOptions } from '../definition/IServiceProviderOptions';\n\nconst showErrorMessage = function (res: ServerResponse, err: string): void {\n\tres.writeHead(200, {\n\t\t'Content-Type': 'text/html',\n\t});\n\tconst content = `<html><body><h2>Sorry, an annoying error occured</h2><div>${escapeHTML(err)}</div></body></html>`;\n\tres.end(content, 'utf-8');\n};\n\nconst convertRoleNamesToIds = async (roleNamesOrIds: string[]): Promise<IRole['_id'][]> => {\n\tconst normalizedRoleNamesOrIds = roleNamesOrIds.map((role) => role.trim()).filter((role) => role.length > 0);\n\tif (!normalizedRoleNamesOrIds.length) {\n\t\tthrow new Error(`No valid role names or ids provided for conversion: ${roleNamesOrIds.join(', ')}`);\n\t}\n\n\tconst roles = (await Roles.findInIdsOrNames(normalizedRoleNamesOrIds).toArray()).map((role) => role._id);\n\n\tif (roles.length !== normalizedRoleNamesOrIds.length) {\n\t\tSystemLogger.warn({\n\t\t\tmsg: 'Failed to convert some role names to ids',\n\t\t\troles: normalizedRoleNamesOrIds,\n\t\t});\n\t}\n\n\tif (!roles.length) {\n\t\tthrow new Error(`We should have at least one existing role to create the user: ${normalizedRoleNamesOrIds.join(', ')}`);\n\t}\n\n\treturn roles;\n};\n","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/2a7de457074cbb4d4373fbd9a4e5bea292c9c764/apps/meteor/server/lib/saml/lib/SAML.ts#L18-L54","documentation":"Error \"No valid role names or ids provided for conversion: ${roleNamesOrIds.join(', ')}\" thrown in RocketChat/Rocket.Chat.","triggerScenarios":"Thrown during SAML role sync when the role mapping settings yield no valid role names or ids to convert.","commonSituations":"See trigger scenarios.","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."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2a7de457074cbb4d4373fbd9a4e5bea292c9c764","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}