{"record":{"id":"09f9a49f5c6dd7bc","repo":"RocketChat/Rocket.Chat","slug":"error-nickname-size-exceeded-09f9a4","errorCode":"error-nickname-size-exceeded","errorMessage":"Nickname size exceeds ${MAX_NICKNAME_LENGTH} characters","messagePattern":"Nickname size exceeds (.+?) characters","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/meteor-methods/users/saveUserProfile.ts","lineNumber":110,"sourceCode":"\t\t\t\tmethod: 'saveUserProfile',\n\t\t\t});\n\t\t}\n\t\tif (settings.bio.length > MAX_BIO_LENGTH) {\n\t\t\tthrow new Meteor.Error('error-bio-size-exceeded', `Bio size exceeds ${MAX_BIO_LENGTH} characters`, {\n\t\t\t\tmethod: 'saveUserProfile',\n\t\t\t});\n\t\t}\n\t\tawait Users.setBio(user._id, settings.bio.trim());\n\t}\n\n\tif (user && (settings.nickname || settings.nickname === '')) {\n\t\tif (typeof settings.nickname !== 'string') {\n\t\t\tthrow new Meteor.Error('error-invalid-field', 'nickname', {\n\t\t\t\tmethod: 'saveUserProfile',\n\t\t\t});\n\t\t}\n\t\tif (settings.nickname.length > MAX_NICKNAME_LENGTH) {\n\t\t\tthrow new Meteor.Error('error-nickname-size-exceeded', `Nickname size exceeds ${MAX_NICKNAME_LENGTH} characters`, {\n\t\t\t\tmethod: 'saveUserProfile',\n\t\t\t});\n\t\t}\n\t\tawait Users.setNickname(user._id, settings.nickname.trim());\n\t}\n\n\tif (user && settings.email) {\n\t\tawait setEmailFunction(settings.email, user);\n\t}\n\n\tconst canChangePasswordForOAuth = rcSettings.get<boolean>('Accounts_AllowPasswordChangeForOAuthUsers');\n\tif (canChangePasswordForOAuth || user?.services?.password) {\n\t\t// Should be the last check to prevent error when trying to check password for users without password\n\t\tif (settings.newPassword && rcSettings.get<boolean>('Accounts_AllowPasswordChange') === true && user?.services?.password?.bcrypt) {\n\t\t\t// don't let user change to same password\n\t\t\tif (user && (await compareUserPassword(user, { plain: settings.newPassword }))) {\n\t\t\t\tthrow new Meteor.Error('error-password-same-as-current', 'Entered password same as current password', {\n\t\t\t\t\tmethod: 'saveUserProfile',","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/meteor-methods/users/saveUserProfile.ts#L92-L128","documentation":"saveUserProfile enforces a nickname length limit: MAX_NICKNAME_LENGTH = 120 characters (apps/meteor/server/meteor-methods/users/saveUserProfile.ts:24). Nicknames longer than 120 characters are rejected before Users.setNickname runs.","triggerScenarios":"settings.nickname.length > 120 in the saveUserProfile call - e.g. a display nickname pasted from a long string with no client-side maxlength.","commonSituations":"Frontends without a nickname character limit; imported data; users pasting full names or emoji-decorated strings that exceed the cap.","solutions":["Add maxLength={120} and a counter to the nickname input","Validate nickname.length <= 120 client-side and block submit","Catch error-nickname-size-exceeded and show 'Nickname must be 120 characters or fewer'"],"exampleFix":"// before\nconst nickname = rawNickname; // unbounded\n\n// after\nconst nickname = rawNickname.slice(0, 120); // or block submit when longer","handlingStrategy":"validation","validationCode":"const MAX_NICKNAME_LENGTH = 120;\nif (typeof nickname === 'string' && nickname.length > MAX_NICKNAME_LENGTH) {\n  throw new RangeError(`Nickname exceeds ${MAX_NICKNAME_LENGTH} characters`);\n}","typeGuard":null,"tryCatchPattern":"catch (err) {\n  if (err instanceof Meteor.Error && err.error === 'error-nickname-size-exceeded') {\n    showFieldError('nickname', 'Nickname must be 120 characters or fewer');\n  }\n}","preventionTips":["Set maxLength=120 on the nickname input with a counter","Block submit when over the limit rather than truncating","Keep the client constant in sync with the server's MAX_NICKNAME_LENGTH"],"tags":["meteor","validation","profile","nickname"],"backgroundTag":"field-length-limit","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}