RocketChat/Rocket.Chat · error · Meteor.Error

error-emoji-param-not-provided

error-emoji-param-not-provided

Error message

The required "emoji" param is missing.

What it means

Thrown by POST chat.react when neither 'emoji' nor the legacy 'reaction' field yields a truthy value. The route body schema (isChatReactProps, a oneOf) already requires either emoji or reaction, so under normal AJV validation this branch is defensive belt-and-suspenders. It can still fire if the schema validator is bypassed or if both fields are empty strings that passed a looser path.

Source

Thrown at apps/meteor/server/api/v1/chat.ts:553

					},
					required: ['success'],
					additionalProperties: false,
				}),
				400: validateBadRequestErrorResponse,
				401: validateUnauthorizedErrorResponse,
			},
		},
		async function action() {
			const msg = await Messages.findOneById(this.bodyParams.messageId);

			if (!msg) {
				throw new Meteor.Error('error-message-not-found', 'The provided "messageId" does not match any existing message.');
			}

			const emoji = 'emoji' in this.bodyParams ? this.bodyParams.emoji : (this.bodyParams as { reaction: string }).reaction;

			if (!emoji) {
				throw new Meteor.Error('error-emoji-param-not-provided', 'The required "emoji" param is missing.');
			}

			await executeSetReaction(this.userId, emoji, msg, this.bodyParams.shouldReact);

			return API.v1.success();
		},
	)
	.post(
		'chat.reportMessage',
		{
			authRequired: true,
			body: isChatReportMessageProps,
			response: {
				200: ajv.compile<void>({
					type: 'object',
					properties: {
						success: {
							type: 'boolean',

View on GitHub (pinned to f9d3ec372b)

Solutions

  1. Include a non-empty 'emoji' field in the body, formatted as ':shortcode:' (e.g. ':thumbsup:').
  2. Pick the value from the emoji picker / server emoji list to ensure it is a known shortcode.
  3. If migrating, prefer 'emoji' over the legacy 'reaction' key.

Example fix

// before
await POST('/api/v1/chat.react', { messageId, reactionName: ':smile:' });
// after
await POST('/api/v1/chat.react', { messageId, emoji: ':smile:' });
Defensive patterns

Strategy: validation

Validate before calling

function buildReactBody(messageId: string, emoji: string) {
  const e = (emoji || '').trim();
  if (!e) throw new Error('emoji is required, e.g. ":smile:"');
  return { messageId, emoji: e };
}

await POST('/api/v1/chat.react', buildReactBody(messageId, chosenEmoji));

Type guard

const isReactBody = (b: unknown): b is { messageId: string; emoji: string } =>
  typeof b === 'object' && b !== null &&
  typeof (b as any).messageId === 'string' &&
  typeof (b as any).emoji === 'string' && (b as any).emoji.length > 0;

Try / catch

try {
  await POST('/api/v1/chat.react', { messageId, emoji });
} catch (e) {
  if ((e as any)?.error === 'error-emoji-param-not-provided') {
    // picker returned empty selection; re-prompt user
  }
  throw e;
}

Prevention

When it happens

Trigger: POST /api/v1/chat.react with { messageId, emoji: '' } or { messageId, reaction: '' }; or a caller that sends { messageId } only on a deployment where the body schema did not run (older server, or a custom middleware).

Common situations: UI emoji picker that submitted before a selection was made; client sending the emoji under 'reactionName' or 'name' instead of 'emoji'; migration from the deprecated 'reaction' field where the new field name was not added.

Related errors


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