RocketChat/Rocket.Chat · error · Meteor.Error
error-nickname-size-exceeded
error-nickname-size-exceeded
Error message
Nickname size exceeds ${MAX_NICKNAME_LENGTH} characters What it means
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.
Source
Thrown at apps/meteor/server/meteor-methods/users/saveUserProfile.ts:110
method: 'saveUserProfile',
});
}
if (settings.bio.length > MAX_BIO_LENGTH) {
throw new Meteor.Error('error-bio-size-exceeded', `Bio size exceeds ${MAX_BIO_LENGTH} characters`, {
method: 'saveUserProfile',
});
}
await Users.setBio(user._id, settings.bio.trim());
}
if (user && (settings.nickname || settings.nickname === '')) {
if (typeof settings.nickname !== 'string') {
throw new Meteor.Error('error-invalid-field', 'nickname', {
method: 'saveUserProfile',
});
}
if (settings.nickname.length > MAX_NICKNAME_LENGTH) {
throw new Meteor.Error('error-nickname-size-exceeded', `Nickname size exceeds ${MAX_NICKNAME_LENGTH} characters`, {
method: 'saveUserProfile',
});
}
await Users.setNickname(user._id, settings.nickname.trim());
}
if (user && settings.email) {
await setEmailFunction(settings.email, user);
}
const canChangePasswordForOAuth = rcSettings.get<boolean>('Accounts_AllowPasswordChangeForOAuthUsers');
if (canChangePasswordForOAuth || user?.services?.password) {
// Should be the last check to prevent error when trying to check password for users without password
if (settings.newPassword && rcSettings.get<boolean>('Accounts_AllowPasswordChange') === true && user?.services?.password?.bcrypt) {
// don't let user change to same password
if (user && (await compareUserPassword(user, { plain: settings.newPassword }))) {
throw new Meteor.Error('error-password-same-as-current', 'Entered password same as current password', {
method: 'saveUserProfile',View on GitHub (pinned to b2c16d5842)
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'
Example fix
// before const nickname = rawNickname; // unbounded // after const nickname = rawNickname.slice(0, 120); // or block submit when longer
Defensive patterns
Strategy: validation
Validate before calling
const MAX_NICKNAME_LENGTH = 120;
if (typeof nickname === 'string' && nickname.length > MAX_NICKNAME_LENGTH) {
throw new RangeError(`Nickname exceeds ${MAX_NICKNAME_LENGTH} characters`);
} Try / catch
catch (err) {
if (err instanceof Meteor.Error && err.error === 'error-nickname-size-exceeded') {
showFieldError('nickname', 'Nickname must be 120 characters or fewer');
}
} Prevention
- 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
When it happens
Trigger: settings.nickname.length > 120 in the saveUserProfile call - e.g. a display nickname pasted from a long string with no client-side maxlength.
Common situations: Frontends without a nickname character limit; imported data; users pasting full names or emoji-decorated strings that exceed the cap.
Related errors
- error-nickname-size-exceeded
- error-invalid-field
- error-bio-size-exceeded
- duplicated-account
- error-invalid-account
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/09f9a49f5c6dd7bc.
Report an issue: GitHub.