RocketChat/Rocket.Chat · error · Error
error-user-not-found
error-user-not-found
Error message
error-user-not-found
What it means
Thrown by GET /api/v1/push.get when Users.findOneById(this.userId) returns null — the authenticated user's document cannot be loaded. Because the caller just passed authentication, this is nearly always a race or data-integrity issue: the user was deleted, or the auth token points at a user record that no longer exists in the users collection.
Solutions
- Treat it as a dead session: log the client out and require fresh authentication
- If unexpected, verify the user still exists via GET /api/v1/users.info?userId=<id> as an admin
- Check for pending delete/merge jobs or restore operations that could have removed the document
Defensive patterns
Strategy: try-catch
Try / catch
catch 'error-user-not-found' from push.get and force a logout/re-auth on the client — the session's user record no longer exists, so every authenticated call is suspect; do not retry.
Prevention
- Invalidate client sessions when user-deletion webhooks fire
- During account merges/deletions, revoke live tokens first
- Treat this error as a signal of data drift worth investigating, not a client bug
When it happens
Trigger: GET /api/v1/push.get?id=<messageId> as a user deleted between token issuance and this request; a restored-from-backup database where tokens exist but user documents are gone; a user merged/deleted by an admin while a mobile client held a valid session.
Common situations: Mobile app keeping a push session open after the account was removed; test environments rebuilt with stale token stores; user deletion racing an in-flight notification fetch.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- error-room-not-found
- error-message-not-found
- error-push-disabled
- error-action-not-allowed
- error-authToken-param-not-valid
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/6b7c07c679762993.
Report an issue: GitHub.
Appendix: source
Thrown at apps/meteor/server/api/v1/push.ts:306
const pushGetInfoEndpoints = API.v1
.get(
'push.get',
{
authRequired: true,
query: isPushGetProps,
response: {
200: pushGetResponseSchema,
400: validateBadRequestErrorResponse,
401: validateUnauthorizedErrorResponse,
},
},
async function action() {
const { id } = this.queryParams;
const receiver = await Users.findOneById(this.userId);
if (!receiver) {
throw new Error('error-user-not-found');
}
const message = await Messages.findOneById(id);
if (!message) {
throw new Error('error-message-not-found');
}
const room = await Rooms.findOneById(message.rid);
if (!room) {
throw new Error('error-room-not-found');
}
if (!(await canAccessRoomAsync(room, receiver))) {
throw new Error('error-not-allowed');
}
const data = await PushNotification.getNotificationForMessageId({ receiver, room, message });
View on GitHub (pinned to b2c16d5842)