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 (apps/meteor/server/api/v1/chat.ts:957) when userId is missing or trims to empty, with error-user-id-param-not-provided. This is the id of the user to ignore (not the caller - the caller comes from auth). Same shape as the rid check above it: schema requires minLength 1, the handler additionally rejects whitespace-only values via !userId?.trim().

Solutions

  1. Send the target user's _id: GET /api/v1/chat.ignoreUser?rid=GENERAL&userId=Y3ofXKDfrqaBppbHp&ignore=true.
  2. Resolve username to id first: GET /api/v1/users.info?username=<name>, then use data.user._id.
  3. Disable the ignore action until a target user is chosen; validate userId.trim() before the request.
  4. Remember `ignore` is a string 'true'/'false' on this GET endpoint, not a boolean.

Example fix

// before
rc.get('/api/v1/chat.ignoreUser', { params: { rid, userId: username, ignore: 'true' } }); // username, not id

// after
const { user } = await rc.get('/api/v1/users.info', { params: { username } });
rc.get('/api/v1/chat.ignoreUser', { params: { rid, userId: user._id, ignore: 'true' } });
Defensive patterns

Strategy: validation

Validate before calling

const { user } = await rc.get('/api/v1/users.info', { params: { username } });
const userId = user?._id?.trim();
if (!userId) throw new Error('target userId is required');
await rc.get('/api/v1/chat.ignoreUser', { params: { rid, userId, ignore: 'true' } });

Type guard

const isIgnoreUserQuery = (p: { rid?: unknown; userId?: unknown }): p is { rid: string; userId: string } =>
  typeof p.rid === 'string' && p.rid.trim().length > 0 &&
  typeof p.userId === 'string' && p.userId.trim().length > 0;

Try / catch

try {
  await rc.get('/api/v1/chat.ignoreUser', { params: { rid, userId, ignore } });
} catch (e) {
  if (e?.errorType === 'error-user-id-param-not-provided') promptUserSelection();
  else throw e;
}

Prevention

When it happens

Trigger: GET /api/v1/chat.ignoreUser?rid=...&userId=%20&ignore=true (whitespace), missing userId on pre-validation servers, or a username passed where the user _id is expected and being blank. The param must be the target user's _id (from users.info or message.u._id).

Common situations: UI 'ignore' buttons whose selected-user state is empty (nothing selected); payloads built from usernames before resolution to ids; user ids with stray whitespace from spreadsheets/imports.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

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

					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 e4b8178b20)