{"record":{"id":"d8a70f3efe558b78","repo":"RocketChat/Rocket.Chat","slug":"error-roomid-param-not-provided-d8a70f","errorCode":"error-roomid-param-not-provided","errorMessage":"The parameter \"roomId\" is required","messagePattern":"The parameter \"roomId\" is required","errorType":"exception","errorClass":"Meteor.Error","httpStatus":400,"severity":"error","filePath":"apps/meteor/server/api/v1/im.ts","lineNumber":799,"sourceCode":"\tresponse: {\n\t\t200: paginatedMessagesResponseSchema,\n\t\t400: validateBadRequestErrorResponse,\n\t\t401: validateUnauthorizedErrorResponse,\n\t\t403: validateForbiddenErrorResponse,\n\t},\n};\n\nconst dmMessagesOthersAction = <Path extends string>(_name: Path): TypedAction<typeof dmMessagesOthersEndpointsProps, Path> =>\n\tasync function action() {\n\t\tif (settings.get('API_Enable_Direct_Message_History_EndPoint') !== true) {\n\t\t\tthrow new Meteor.Error('error-endpoint-disabled', 'This endpoint is disabled', {\n\t\t\t\troute: '/api/v1/im.messages.others',\n\t\t\t});\n\t\t}\n\n\t\tconst { roomId } = this.queryParams;\n\t\tif (!roomId) {\n\t\t\tthrow new Meteor.Error('error-roomid-param-not-provided', 'The parameter \"roomId\" is required');\n\t\t}\n\n\t\tconst room = await Rooms.findOneById<Pick<IRoom, '_id' | 't'>>(roomId, { projection: { _id: 1, t: 1 } });\n\t\tif (!room || room?.t !== 'd') {\n\t\t\tthrow new Meteor.Error('error-room-not-found', `No direct message room found by the id of: ${roomId}`);\n\t\t}\n\n\t\tconst { offset, count } = await getPaginationItems(this.queryParams);\n\t\tconst { sort, fields, query } = await this.parseJsonQuery();\n\t\tconst ourQuery = Object.assign({}, query, { rid: room._id });\n\n\t\tconst { cursor, totalCount } = Messages.findPaginated<IMessage>(ourQuery, {\n\t\t\tsort: sort || { ts: -1 },\n\t\t\tskip: offset,\n\t\t\tlimit: count,\n\t\t\tprojection: fields,\n\t\t});\n","sourceCodeStart":781,"sourceCodeEnd":817,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/server/api/v1/im.ts#L781-L817","documentation":"dmMessagesOthersAction reads roomId from this.queryParams and throws error-roomid-param-not-provided when missing. Note the distinct error code 'error-roomid-param-not-provided' (with the 'id' segment) used only here, vs 'error-room-param-not-provided' used elsewhere.","triggerScenarios":"GET /api/v1/im.messages.others without a roomId query parameter or with roomId sent in the body.","commonSituations":"Client omits roomId; passes a wrong key; passes only count/offset.","solutions":["Append roomId to the query string: GET /api/v1/im.messages.others?roomId=<rid>.","Use the exact key 'roomId'.","Confirm the value is non-empty."],"exampleFix":"// before\nGET /api/v1/im.messages.others\n\n// after\nGET /api/v1/im.messages.others?roomId=<rid>","handlingStrategy":"validation","validationCode":"function buildMessagesOthersQuery(roomId) {\n  if (!roomId) throw new TypeError('roomId query param is required');\n  return { roomId };\n}\nawait api.get('/api/v1/im.messages.others', { params: buildMessagesOthersQuery(roomId) });","typeGuard":"function hasRoomIdQueryParam(q: unknown): q is { roomId: string } {\n  return typeof (q as any)?.roomId === 'string' && (q as any).roomId.length > 0;\n}","tryCatchPattern":null,"preventionTips":["im.messages.others takes roomId from the query string.","Watch the distinct error code 'error-roomid-param-not-provided'.","Reject empty roomId before sending."],"tags":["validation","query-param","direct-message","api"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}