{"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":957,"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":939,"sourceCodeEnd":975,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/server/api/v1/chat.ts#L939-L975","documentation":"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.","triggerScenarios":"GET /api/v1/chat.ignoreUser?rid=<roomId>&ignore=true with no userId; passing the target user under 'uid'/'user'/'targetUserId'.","commonSituations":"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.","solutions":["Include the target userId: chat.ignoreUser?rid=GENERAL&userId=<targetUid>&ignore=true.","Resolve the target user id from the message author or member list before invoking.","Ensure the value is non-empty after trim."],"exampleFix":"// before\nGET /api/v1/chat.ignoreUser?rid=GENERAL&ignore=true\n// after\nGET /api/v1/chat.ignoreUser?rid=GENERAL&userId=abc123&ignore=true","handlingStrategy":"validation","validationCode":"function buildIgnoreUrl(rid: string, userId: string, ignore = true) {\n  if (!userId?.trim()) throw new Error('userId query param is required for chat.ignoreUser');\n  const u = new URL('/api/v1/chat.ignoreUser', location.origin);\n  u.searchParams.set('rid', rid);\n  u.searchParams.set('userId', userId);\n  u.searchParams.set('ignore', String(ignore));\n  return u;\n}","typeGuard":"const isIgnoreQuery = (q: unknown): q is { rid: string; userId: string } =>\n  typeof q === 'object' && q !== null &&\n  typeof (q as any).userId === 'string' && (q as any).userId.trim().length > 0;","tryCatchPattern":"try {\n  await GET(ignoreUrl);\n} catch (e) {\n  if ((e as any)?.error === 'error-user-id-param-not-provided') {\n    // target user not resolved — re-pick from member list\n  }\n  throw e;\n}","preventionTips":["Always resolve the target userId from the message author or member list before invoking.","Use the exact param name 'userId', not 'uid'/'user'/'target'.","Validate both rid and userId in one helper so neither is forgotten."],"tags":["api","rest","validation","query-params","chat","ignore"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}