RocketChat/Rocket.Chat · error · Error

SAML User Map: Invalid RegEx

Error message

SAML User Map: Invalid RegEx

What it means

Error "SAML User Map: Invalid RegEx" thrown in RocketChat/Rocket.Chat.

Source

Thrown at apps/meteor/server/lib/saml/lib/Utils.ts:334

				}

				const fieldName = attribute.fieldName || attribute.fieldNames;
				const { regex, template } = attribute;

				if (Array.isArray(fieldName)) {
					if (!fieldName.length) {
						throw new Error(`SAML User Map: Invalid configuration for ${spFieldName} field.`);
					}

					for (const idpFieldName of fieldName) {
						parsedMap.attributeList.add(idpFieldName);
					}
				} else {
					parsedMap.attributeList.add(fieldName);
				}

				if (regex && typeof regex !== 'string') {
					throw new Error('SAML User Map: Invalid RegEx');
				}

				if (template && typeof template !== 'string') {
					throw new Error('SAML User Map: Invalid Template');
				}

				attributeMap = {
					fieldName,
					...(regex && { regex }),
					...(template && { template }),
				};
			} else if (typeof attribute === 'string') {
				attributeMap = {
					fieldName: attribute,
				};
				parsedMap.attributeList.add(attribute);
			}

View on GitHub (pinned to 2a7de45707)

Solutions

  1. Fix the regular expression in the SAML user data map entry so it compiles.

When it happens

Trigger: Thrown when a SAML user map regex override contains a regular expression that fails to compile.

Common situations: See trigger scenarios.


AI-assisted analysis of RocketChat/Rocket.Chat@2a7de45707 (2026-08-18). Data as JSON: /api/errors/8117f60bcc5cea4a. Report an issue: GitHub.