{"record":{"id":"7e8b0a70e1a38a88","repo":"RocketChat/Rocket.Chat","slug":"error-invalid-user-7e8b0a","errorCode":"error-invalid-user","errorMessage":"Invalid user","messagePattern":"Invalid user","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/ee/server/meteor-methods/getReadReceipts.ts","lineNumber":47,"sourceCode":"\t\t});\n\t}\n\n\tif (!(await canAccessRoomIdAsync(message.rid, userId))) {\n\t\tthrow new Meteor.Error('error-invalid-room', 'Invalid room', { method: 'getReadReceipts' });\n\t}\n\n\treturn ReadReceipt.getReceipts(message);\n};\n\nMeteor.methods<ServerMethods>({\n\tasync getReadReceipts({ messageId }) {\n\t\tmethodDeprecationLogger.method('getReadReceipts', '9.0.0', '/v1/chat.getMessageReadReceipts');\n\n\t\tcheck(messageId, String);\n\n\t\tconst uid = Meteor.userId();\n\t\tif (!uid) {\n\t\t\tthrow new Meteor.Error('error-invalid-user', 'Invalid user', { method: 'getReadReceipts' });\n\t\t}\n\n\t\treturn getReadReceiptsFunction(messageId, uid);\n\t},\n});\n","sourceCodeStart":29,"sourceCodeEnd":53,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/ee/server/meteor-methods/getReadReceipts.ts#L29-L53","documentation":"Thrown by the getReadReceipts Meteor.methods handler when Meteor.userId() is falsy. The method requires an authenticated session; with no uid it cannot scope receipts to a user. Code is 'error-invalid-user'.","triggerScenarios":"Calling the getReadReceipts method while unauthenticated — anonymous visitor, expired session, or a bot/Integration calling the DDP method without a login.","commonSituations":"Session expired client-side but UI still mounted; integration invoking the method without a user binding; testing a method call without logging in.","solutions":["Ensure the client is logged in before calling getReadReceipts (re-auth on session expiry).","Gate the UI element behind an authenticated-state check.","For integrations, use a connected user/bot account and a valid auth token."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const uid = Meteor.userId();\nif (!uid) {\n  redirectToLogin();\n  return;\n}\nconst receipts = await getReadReceiptsFunction(messageId, uid);","typeGuard":"function isAuthenticated(uid: string | null | undefined): uid is string {\n  return typeof uid === 'string' && uid.length > 0;\n}","tryCatchPattern":"try {\n  await Meteor.callAsync('getReadReceipts', { messageId });\n} catch (e) {\n  if (isMeteorError(e, 'error-invalid-user')) {\n    redirectToLogin();\n    return;\n  }\n  throw e;\n}","preventionTips":["Ensure the session is authenticated before calling.","Re-authenticate on session expiry.","For integrations, bind a valid user/bot token."],"tags":["read-receipts","authentication","authorization"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}