{"record":{"id":"6b7c07c679762993","repo":"RocketChat/Rocket.Chat","slug":"error-user-not-found-6b7c07","errorCode":"error-user-not-found","errorMessage":"error-user-not-found","messagePattern":"error-user-not-found","errorType":"exception","errorClass":"Error","httpStatus":400,"severity":"error","filePath":"apps/meteor/server/api/v1/push.ts","lineNumber":306,"sourceCode":"\nconst pushGetInfoEndpoints = API.v1\n\t.get(\n\t\t'push.get',\n\t\t{\n\t\t\tauthRequired: true,\n\t\t\tquery: isPushGetProps,\n\t\t\tresponse: {\n\t\t\t\t200: pushGetResponseSchema,\n\t\t\t\t400: validateBadRequestErrorResponse,\n\t\t\t\t401: validateUnauthorizedErrorResponse,\n\t\t\t},\n\t\t},\n\t\tasync function action() {\n\t\t\tconst { id } = this.queryParams;\n\n\t\t\tconst receiver = await Users.findOneById(this.userId);\n\t\t\tif (!receiver) {\n\t\t\t\tthrow new Error('error-user-not-found');\n\t\t\t}\n\n\t\t\tconst message = await Messages.findOneById(id);\n\t\t\tif (!message) {\n\t\t\t\tthrow new Error('error-message-not-found');\n\t\t\t}\n\n\t\t\tconst room = await Rooms.findOneById(message.rid);\n\t\t\tif (!room) {\n\t\t\t\tthrow new Error('error-room-not-found');\n\t\t\t}\n\n\t\t\tif (!(await canAccessRoomAsync(room, receiver))) {\n\t\t\t\tthrow new Error('error-not-allowed');\n\t\t\t}\n\n\t\t\tconst data = await PushNotification.getNotificationForMessageId({ receiver, room, message });\n","sourceCodeStart":288,"sourceCodeEnd":324,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/api/v1/push.ts#L288-L324","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"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.","preventionTips":["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"],"tags":["push","notifications","users","data-integrity","rest-api"],"backgroundTag":"resource-not-found","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}