RocketChat/Rocket.Chat · error · Meteor.Error
error-invalid-user
error-invalid-user
Error message
Invalid user
What it means
The deprecated `e2e.requestSubscriptionKeys` method (replacement: `/v1/e2e.requestSubscriptionKeys`) re-broadcasts `notify.e2e.keyRequest` for the user's encrypted rooms; it throws `error-invalid-user` when `Meteor.userId()` is null. Re-requesting E2E room keys only makes sense for an authenticated session.
Source
Thrown at apps/meteor/server/meteor-methods/platform/requestSubscriptionKeys.ts:42
},
_id: {
$in: roomIds,
},
};
const rooms = Rooms.find(query);
await rooms.forEach((room) => {
void api.broadcast('notify.e2e.keyRequest', room._id, room.e2eKeyId);
});
};
Meteor.methods<ServerMethods>({
async 'e2e.requestSubscriptionKeys'() {
methodDeprecationLogger.method('e2e.requestSubscriptionKeys', '9.0.0', '/v1/e2e.requestSubscriptionKeys');
const userId = Meteor.userId();
if (!userId) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', {
method: 'requestSubscriptionKeys',
});
}
await requestSubscriptionKeysMethod(userId);
return true;
},
});
View on GitHub (pinned to b2c16d5842)
Solutions
- Authenticate before invoking the method
- Cancel/flush pending E2E retry queues on logout so they cannot fire without a session
- Migrate to `/v1/e2e.requestSubscriptionKeys`
Example fix
// before
retryQueue.add(() => Meteor.call('e2e.requestSubscriptionKeys'));
// after
retryQueue.add(() => {
if (!Meteor.userId()) return; // session gone, skip
Meteor.call('e2e.requestSubscriptionKeys');
}); Defensive patterns
Strategy: validation
Validate before calling
if (!Meteor.userId()) {
return; // session gone, drop the retry
}
Meteor.call('e2e.requestSubscriptionKeys', cb); Try / catch
try {
await Meteor.callAsync('e2e.requestSubscriptionKeys');
} catch (e) {
if (e instanceof Meteor.Error && e.error === 'error-invalid-user') {
// stop the retry queue; re-run after login
}
} Prevention
- Flush E2E retry queues on logout
- Only enqueue key-request retries while a session exists
- Migrate to /v1/e2e.requestSubscriptionKeys
When it happens
Trigger: Calling `Meteor.call('e2e.requestSubscriptionKeys')` from a logged-out connection — typically a client E2E retry queue flushing after logout, or a startup race before login.
Common situations: Logout while encrypted-room key requests are still pending; client retry timers surviving session teardown; scripts forgetting to authenticate.
Related errors
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/29fd49cc4e8513dd.
Report an issue: GitHub.