RocketChat/Rocket.Chat · error · Meteor.Error

error-user-id-param-not-provided

error-user-id-param-not-provided

Error message

The required "userId" param is missing.

What it means

Thrown by GET chat.ignoreUser when 'userId' (the user to ignore) is missing or whitespace-only. Checked at chat.ts:956 right after the rid guard. Same manual validation path as error 369.

Source

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

					required: ['success'],
					additionalProperties: false,
				}),
				400: validateBadRequestErrorResponse,
				401: validateUnauthorizedErrorResponse,
			},
		},
		async function action() {
			const { rid, userId } = this.queryParams;
			let { ignore = true } = this.queryParams;

			ignore = typeof ignore === 'string' ? /true|1/.test(ignore) : ignore;

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

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

			await ignoreUser(this.userId, { rid, userId, ignore });

			return API.v1.success();
		},
	)
	.get(
		'chat.getDeletedMessages',
		{
			authRequired: true,
			query: isChatGetDeletedMessagesProps,
			response: {
				200: ajv.compile<{ messages: Pick<IMessage, '_id'>[]; count: number; offset: number; total: number }>({
					type: 'object',
					properties: {
						messages: { type: 'array', items: { type: 'object' } }, // relaxed: only _id is projected,
						count: { type: 'number' },

View on GitHub (pinned to f9d3ec372b)

Solutions

  1. Include the target userId: chat.ignoreUser?rid=GENERAL&userId=<targetUid>&ignore=true.
  2. Resolve the target user id from the message author or member list before invoking.
  3. Ensure the value is non-empty after trim.

Example fix

// before
GET /api/v1/chat.ignoreUser?rid=GENERAL&ignore=true
// after
GET /api/v1/chat.ignoreUser?rid=GENERAL&userId=abc123&ignore=true
Defensive patterns

Strategy: validation

Validate before calling

function buildIgnoreUrl(rid: string, userId: string, ignore = true) {
  if (!userId?.trim()) throw new Error('userId query param is required for chat.ignoreUser');
  const u = new URL('/api/v1/chat.ignoreUser', location.origin);
  u.searchParams.set('rid', rid);
  u.searchParams.set('userId', userId);
  u.searchParams.set('ignore', String(ignore));
  return u;
}

Type guard

const isIgnoreQuery = (q: unknown): q is { rid: string; userId: string } =>
  typeof q === 'object' && q !== null &&
  typeof (q as any).userId === 'string' && (q as any).userId.trim().length > 0;

Try / catch

try {
  await GET(ignoreUrl);
} catch (e) {
  if ((e as any)?.error === 'error-user-id-param-not-provided') {
    // target user not resolved — re-pick from member list
  }
  throw e;
}

Prevention

When it happens

Trigger: GET /api/v1/chat.ignoreUser?rid=<roomId>&ignore=true with no userId; passing the target user under 'uid'/'user'/'targetUserId'.

Common situations: UI mute/ignore button that has the room context but not the target user id resolved yet; SDK that exposes ignoreUser(rid) with a separate fluent call that was skipped.

Related errors


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