RocketChat/Rocket.Chat · error · Meteor.Error

Emoji not found.

Error message

Emoji not found.

What it means

Thrown by POST emoji-custom.update when EmojiCustom.findOneById(fields._id) returns null — no custom emoji exists for that id. Same Meteor.Error construction defect as 395 (message string in the code slot, no structured code). Means the id is wrong or the emoji was deleted between page load and update.

Source

Thrown at apps/meteor/server/api/v1/emoji-custom.ts:254

		async function action() {
			const emoji = await getUploadFormData(
				{
					request: this.request,
				},
				{ field: 'emoji', sizeLimit: settings.get('FileUpload_MaxFileSize'), fileOptional: true },
			);

			const { fields, fileBuffer, mimetype } = emoji;

			if (!fields._id) {
				throw new Meteor.Error('The required "_id" query param is missing.');
			}

			const emojiToUpdate = await EmojiCustom.findOneById<Pick<IEmojiCustom, 'name' | 'extension'>>(fields._id, {
				projection: { name: 1, extension: 1 },
			});
			if (!emojiToUpdate) {
				throw new Meteor.Error('Emoji not found.');
			}

			const emojiData: EmojiData = {
				previousName: emojiToUpdate.name,
				previousExtension: emojiToUpdate.extension,
				aliases: fields.aliases || '',
				name: fields.name,
				extension: fields.extension,
				_id: fields._id,
				newFile: false,
			};

			const isNewFile = fileBuffer?.length && !!mimetype;
			if (isNewFile) {
				emojiData.newFile = isNewFile;
				const isUploadable = await Media.isImage(fileBuffer);
				if (!isUploadable) {
					throw new Meteor.Error('emoji-is-not-image', "Emoji file provided cannot be uploaded since it's not an image");

View on GitHub (pinned to f9d3ec372b)

Solutions

  1. Reload the emoji list and use a current _id.
  2. Handle as a not-found condition and surface a clear message to the user.
  3. If the emoji should exist, verify it was not deleted and check the id spelling.
Defensive patterns

Strategy: validation

Validate before calling

const exists = await EmojiCustom.findOneById(_id);
if (!exists) { /* reload list; do not call update */ }

Type guard

function isExistingEmoji(e): e is { _id: string } { return !!e && typeof e._id === 'string'; }

Try / catch

try { await updateEmojiCustom(fd); }
catch (e) {
  if (/Emoji not found/i.test(e?.error || '')) { /* reload emoji list and pick a current id */) }
  else throw e;
}

Prevention

When it happens

Trigger: Updating an emoji that another admin deleted; typo in _id; stale id held in the client; _id from a different workspace.

Common situations: Two admins managing emojis concurrently; long-open edit form whose target was removed; cache desync.

Related errors


AI-assisted analysis of RocketChat/Rocket.Chat@f9d3ec372b (2026-08-12). Data as JSON: /api/errors/93be2ecdb3aa2d29. Report an issue: GitHub.