{"record":{"id":"d4ed1ccb08ec2274","repo":"RocketChat/Rocket.Chat","slug":"please-verify-your-mapping-for-ldap-x-rocketchat-t","errorCode":null,"errorMessage":"Please verify your mapping for LDAP X RocketChat Teams. The structure is invalid, the structure should be an object like: {key: LdapTeam, value: [An array of rocket.chat teams]}","messagePattern":"Please verify your mapping for LDAP X RocketChat Teams\\. The structure is invalid, the structure should be an object like: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/ee/server/lib/ldap/Manager.ts","lineNumber":174,"sourceCode":"\t\t}\n\t}\n\n\tpublic static validateLDAPTeamsMappingChanges(json: string): void {\n\t\tif (!json) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst mustBeAnArrayOfStrings = (array: Array<string>): boolean =>\n\t\t\tBoolean(Array.isArray(array) && array.length && array.every((item) => typeof item === 'string'));\n\t\tconst mappedTeams = this.parseJson(json);\n\t\tif (!mappedTeams) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst mappedRocketChatTeams = Object.values(mappedTeams);\n\t\tconst validStructureMapping = mappedRocketChatTeams.every(mustBeAnArrayOfStrings);\n\t\tif (!validStructureMapping) {\n\t\t\tthrow new Error(\n\t\t\t\t'Please verify your mapping for LDAP X RocketChat Teams. The structure is invalid, the structure should be an object like: {key: LdapTeam, value: [An array of rocket.chat teams]}',\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic static validateLDAPABACAttributeMap(json: string): void {\n\t\tif (!json) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst mappedAttributes = this.parseJson(json);\n\n\t\t// attributes are { key: value } with key being the ldap attribute and value being the abac attribute in rocketchat\n\t\t// both strings\n\t\t// There's no need for the attribute to exist in rocketchat, we just add whatever the admin wants to map\n\n\t\tif (!mappedAttributes || Object.keys(mappedAttributes).length === 0) {\n\t\t\treturn;","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/ee/server/lib/ldap/Manager.ts#L156-L192","documentation":"Thrown by Manager.validateLDAPTeamMap when the parsed LDAP_Team_Map JSON is an object whose values are not all non-empty arrays of strings. The validator first runs mustBeAnArrayOfStrings on each value (Object.values(mappedTeams).every(...)). Plain Error. Empty/null JSON returns early and does not throw; the failure is specifically a shape mismatch.","triggerScenarios":"Admin saves LDAP_Team_Map (or LDAP_Group_Filter_Mapping) with a value that is a single string instead of an array, an empty array, an array containing non-strings, or a non-array value.","commonSituations":"Copy-pasted mapping from docs that used the wrong shape; manual JSON edit that dropped the array brackets; mapping one team to a single string '{\"ldap-grp\": \"rocket-team\"}' instead of '{\"ldap-grp\": [\"rocket-team\"]}'.","solutions":["Format the mapping as {\"<ldapTeamKey>\": [\"<rocketChatTeamId>\", ...]} with every value a non-empty string array.","Validate the JSON in a linter/JSON parser before saving; ensure arrays even for single-element mappings.","Re-save the corrected value and trigger an LDAP sync to confirm."],"exampleFix":"// before (throws — value is a string, not an array)\n{\"cn=devs\": \"rocket-devs\"}\n\n// after\n{\"cn=devs\": [\"rocket-devs\"]}","handlingStrategy":"validation","validationCode":"function validateTeamMap(json: string): void {\n  const obj = JSON.parse(json);\n  const ok = Object.values(obj).every((v) => Array.isArray(v) && v.length > 0 && v.every((i) => typeof i === 'string'));\n  if (!ok) throw new Error('LDAP team map must be Record<string, string[]>');\n}","typeGuard":"const isTeamMap = (o: unknown): o is Record<string, string[]> =>\n  typeof o === 'object' && o !== null && Object.values(o).every((v) => Array.isArray(v) && v.every((i) => typeof i === 'string'));","tryCatchPattern":"try { Manager.validateLDAPTeamMap(json); } catch (e) {\n  if (e instanceof Error && e.message.includes('LDAP X RocketChat Teams')) { /* fix JSON shape and re-save */ } else throw e;\n}","preventionTips":["Always wrap single team names in an array.","Lint LDAP mapping JSON in CI for admin config exports.","Document the exact {key: string[]} shape next to the setting."],"tags":["ldap","config","mapping","enterprise"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}