{"record":{"id":"9d2f57564dc7e2c6","repo":"RocketChat/Rocket.Chat","slug":"error-user-id-param-not-provided","errorCode":"error-user-id-param-not-provided","errorMessage":"The required \"userId\" param is missing.","messagePattern":"The required \"userId\" param is missing\\.","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/api/v1/chat.ts","lineNumber":962,"sourceCode":"\t\t\t\t\trequired: ['success'],\n\t\t\t\t\tadditionalProperties: false,\n\t\t\t\t}),\n\t\t\t\t400: validateBadRequestErrorResponse,\n\t\t\t\t401: validateUnauthorizedErrorResponse,\n\t\t\t},\n\t\t},\n\t\tasync function action() {\n\t\t\tconst { rid, userId } = this.queryParams;\n\t\t\tlet { ignore = true } = this.queryParams;\n\n\t\t\tignore = typeof ignore === 'string' ? /true|1/.test(ignore) : ignore;\n\n\t\t\tif (!rid?.trim()) {\n\t\t\t\tthrow new Meteor.Error('error-room-id-param-not-provided', 'The required \"rid\" param is missing.');\n\t\t\t}\n\n\t\t\tif (!userId?.trim()) {\n\t\t\t\tthrow new Meteor.Error('error-user-id-param-not-provided', 'The required \"userId\" param is missing.');\n\t\t\t}\n\n\t\t\tawait ignoreUser(this.userId, { rid, userId, ignore });\n\n\t\t\treturn API.v1.success();\n\t\t},\n\t)\n\t.get(\n\t\t'chat.getDeletedMessages',\n\t\t{\n\t\t\tauthRequired: true,\n\t\t\tquery: isChatGetDeletedMessagesProps,\n\t\t\tresponse: {\n\t\t\t\t200: ajv.compile<{ messages: Pick<IMessage, '_id'>[]; count: number; offset: number; total: number }>({\n\t\t\t\t\ttype: 'object',\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tmessages: { type: 'array', items: { type: 'object' } }, // relaxed: only _id is projected,\n\t\t\t\t\t\tcount: { type: 'number' },","sourceCodeStart":944,"sourceCodeEnd":980,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/e4b8178b205510181a96ceefee043d0abcd13e5a/apps/meteor/server/api/v1/chat.ts#L944-L980","documentation":"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().","triggerScenarios":"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).","commonSituations":"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.","solutions":["Send the target user's _id: GET /api/v1/chat.ignoreUser?rid=GENERAL&userId=Y3ofXKDfrqaBppbHp&ignore=true.","Resolve username to id first: GET /api/v1/users.info?username=<name>, then use data.user._id.","Disable the ignore action until a target user is chosen; validate userId.trim() before the request.","Remember `ignore` is a string 'true'/'false' on this GET endpoint, not a boolean."],"exampleFix":"// before\nrc.get('/api/v1/chat.ignoreUser', { params: { rid, userId: username, ignore: 'true' } }); // username, not id\n\n// after\nconst { user } = await rc.get('/api/v1/users.info', { params: { username } });\nrc.get('/api/v1/chat.ignoreUser', { params: { rid, userId: user._id, ignore: 'true' } });","handlingStrategy":"validation","validationCode":"const { user } = await rc.get('/api/v1/users.info', { params: { username } });\nconst userId = user?._id?.trim();\nif (!userId) throw new Error('target userId is required');\nawait rc.get('/api/v1/chat.ignoreUser', { params: { rid, userId, ignore: 'true' } });","typeGuard":"const isIgnoreUserQuery = (p: { rid?: unknown; userId?: unknown }): p is { rid: string; userId: string } =>\n  typeof p.rid === 'string' && p.rid.trim().length > 0 &&\n  typeof p.userId === 'string' && p.userId.trim().length > 0;","tryCatchPattern":"try {\n  await rc.get('/api/v1/chat.ignoreUser', { params: { rid, userId, ignore } });\n} catch (e) {\n  if (e?.errorType === 'error-user-id-param-not-provided') promptUserSelection();\n  else throw e;\n}","preventionTips":["Resolve usernames to user _ids via users.info before calling - chat.ignoreUser takes ids only.","Block the ignore action until a target user is selected; trim ids from imported data."],"tags":["rocket-chat","rest-api","ignore-user","missing-parameter","chat-ignoreuser"],"backgroundTag":"missing-required-argument","analyzedSha":"e4b8178b205510181a96ceefee043d0abcd13e5a","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}