RocketChat/Rocket.Chat · error · Meteor.Error
error-invalid-user
error-invalid-user
Error message
Invalid user
What it means
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'.
Source
Thrown at apps/meteor/ee/server/meteor-methods/getReadReceipts.ts:47
});
}
if (!(await canAccessRoomIdAsync(message.rid, userId))) {
throw new Meteor.Error('error-invalid-room', 'Invalid room', { method: 'getReadReceipts' });
}
return ReadReceipt.getReceipts(message);
};
Meteor.methods<ServerMethods>({
async getReadReceipts({ messageId }) {
methodDeprecationLogger.method('getReadReceipts', '9.0.0', '/v1/chat.getMessageReadReceipts');
check(messageId, String);
const uid = Meteor.userId();
if (!uid) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', { method: 'getReadReceipts' });
}
return getReadReceiptsFunction(messageId, uid);
},
});
View on GitHub (pinned to f9d3ec372b)
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.
Defensive patterns
Strategy: validation
Validate before calling
const uid = Meteor.userId();
if (!uid) {
redirectToLogin();
return;
}
const receipts = await getReadReceiptsFunction(messageId, uid); Type guard
function isAuthenticated(uid: string | null | undefined): uid is string {
return typeof uid === 'string' && uid.length > 0;
} Try / catch
try {
await Meteor.callAsync('getReadReceipts', { messageId });
} catch (e) {
if (isMeteorError(e, 'error-invalid-user')) {
redirectToLogin();
return;
}
throw e;
} Prevention
- Ensure the session is authenticated before calling.
- Re-authenticate on session expiry.
- For integrations, bind a valid user/bot token.
When it happens
Trigger: Calling the getReadReceipts method while unauthenticated — anonymous visitor, expired session, or a bot/Integration calling the DDP method without a login.
Common situations: Session expired client-side but UI still mounted; integration invoking the method without a user binding; testing a method call without logging in.
Related errors
- error-action-not-allowed
- error-invalid-room
- Invalid integration id or token provided.
- Could not open popup
- error-action-not-allowed
AI-assisted analysis of RocketChat/Rocket.Chat@f9d3ec372b (2026-08-12).
Data as JSON: /api/errors/7e8b0a70e1a38a88.
Report an issue: GitHub.