RocketChat/Rocket.Chat · error · MeteorError

error-bio-size-exceeded

error-bio-size-exceeded

Error message

Bio size exceeds ${MAX_BIO_LENGTH} characters

What it means

saveUserProfile's bio handler throws error-bio-size-exceeded (MeteorError, method 'saveUserProfile') when the submitted bio is longer than 260 characters. The check uses the raw bio.length, so it fires even if the extra length is only whitespace; a whitespace-only bio is treated as empty and unsets the field instead.

Source

Thrown at apps/meteor/server/lib/users/saveUser/handleBio.ts:12

import { MeteorError } from '@rocket.chat/core-services';
import type { IUser } from '@rocket.chat/core-typings';
import type { Updater } from '@rocket.chat/model-typings';

import type { SaveUserData } from './saveUser';

const MAX_BIO_LENGTH = 260;

export const handleBio = (userUpdater: Updater<IUser>, bio: SaveUserData['bio']) => {
	if (bio?.trim()) {
		if (bio.length > MAX_BIO_LENGTH) {
			throw new MeteorError('error-bio-size-exceeded', `Bio size exceeds ${MAX_BIO_LENGTH} characters`, {
				method: 'saveUserProfile',
			});
		}
		userUpdater.set('bio', bio);
	} else {
		userUpdater.unset('bio');
	}
};

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Enforce maxLength=260 on the bio input in the UI so the server guard never triggers
  2. Trim/validate bio.length <= 260 before calling the profile-save method
  3. If a longer bio is a product requirement, this limit is hard-coded (MAX_BIO_LENGTH in handleBio.ts) and requires a source change

Example fix

// before
await saveUserProfile({ bio }); // 300 chars -> error-bio-size-exceeded

// after
const MAX_BIO_LENGTH = 260;
const bio = rawBio.slice(0, MAX_BIO_LENGTH); // or block submit when over
await saveUserProfile({ bio });
Defensive patterns

Strategy: validation

Validate before calling

const MAX_BIO_LENGTH = 260; // must match handleBio.ts
if (bio && bio.length > MAX_BIO_LENGTH) {
  throw new Error(`Bio must be at most ${MAX_BIO_LENGTH} characters`);
}
await saveUserProfile({ bio });

Type guard

const isBioWithinLimit = (bio: string | undefined): boolean => !bio || bio.length <= 260;

Try / catch

try {
  await saveUserProfile({ bio });
} catch (e) {
  if (isMeteorErrorCode(e, 'error-bio-size-exceeded')) {
  	showCounterError('bio', 260);
  }
}

Prevention

When it happens

Trigger: Profile save with a bio of 261+ characters: pasted 'about me' text, link lists, or bios imported from another system; client textarea without a maxLength attribute.

Common situations: Users pasting long bios pasted from LinkedIn/social profiles; mobile keyboards inserting trailing newlines pushing length over the limit.

Related errors


AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18). Data as JSON: /api/errors/3d913371cbb8ddea. Report an issue: GitHub.