{"record":{"id":"74241ea860cd428e","repo":"RocketChat/Rocket.Chat","slug":"error-invalid-user-74241e","errorCode":"error-invalid-user","errorMessage":"Invalid user","messagePattern":"Invalid user","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/meteor-methods/users/ignoreUser.ts","lineNumber":55,"sourceCode":"\tconst result = await Subscriptions.ignoreUser({ _id: subscription._id, ignoredUser, ignore });\n\n\tif (result.modifiedCount) {\n\t\tvoid notifyOnSubscriptionChangedById(subscription._id);\n\t}\n\n\treturn !!result;\n};\n\nMeteor.methods<ServerMethods>({\n\tasync ignoreUser({ rid, userId: ignoredUser, ignore = true }) {\n\t\tmethodDeprecationLogger.method('ignoreUser', '9.0.0', '/v1/chat.ignoreUser');\n\t\tcheck(ignoredUser, String);\n\t\tcheck(rid, String);\n\t\tcheck(ignore, Boolean);\n\n\t\tconst userId = Meteor.userId();\n\t\tif (!userId) {\n\t\t\tthrow new Meteor.Error('error-invalid-user', 'Invalid user', {\n\t\t\t\tmethod: 'ignoreUser',\n\t\t\t});\n\t\t}\n\n\t\treturn ignoreUser(userId, { rid, userId: ignoredUser, ignore });\n\t},\n});\n","sourceCodeStart":37,"sourceCodeEnd":63,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/meteor-methods/users/ignoreUser.ts#L37-L63","documentation":"The DDP wrapper for ignoreUser found no authenticated caller: Meteor.userId() returned null, so the method throws error-invalid-user before any subscription checks. The method is deprecated since 9.0.0; the logger points to /v1/chat.ignoreUser as the replacement surface.","triggerScenarios":"Meteor.callAsync('ignoreUser', { rid, userId, ignore }) fired without a valid DDP login — guest session, after logout, or expired resume token.","commonSituations":"Ignore toggles in room member lists clicked on logged-out views; long-lived tabs with expired tokens; calls racing a logout.","solutions":["Guard with Meteor.userId() before showing or firing the ignore toggle","Re-authenticate and retry once on this error","Migrate off the deprecated method to the REST equivalent with proper auth headers"],"exampleFix":"// before\nMeteor.callAsync('ignoreUser', { rid, userId, ignore: true });\n\n// after\nif (!Meteor.userId()) {\n\tthrow new Error('login required');\n}\nawait Meteor.callAsync('ignoreUser', { rid, userId, ignore: true });","handlingStrategy":"validation","validationCode":"if (!Meteor.userId()) {\n\tthrow new Error('login required');\n}\nawait Meteor.callAsync('ignoreUser', { rid, userId, ignore: true });","typeGuard":null,"tryCatchPattern":"try {\n\tawait Meteor.callAsync('ignoreUser', { rid, userId, ignore: true });\n} catch (err) {\n\tif ((err as { error?: string }).error === 'error-invalid-user') {\n\t\t// no session — re-login then retry once\n\t}\n}","preventionTips":["Show ignore toggles only for authenticated sessions","Handle expired tokens with a global re-auth hook","Plan migration off the deprecated method (9.0.0) to the REST surface"],"tags":["meteor","ddp","authentication","ignore","deprecation"],"backgroundTag":"user-not-authenticated","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}