{"record":{"id":"9d69592f26be100a","repo":"RocketChat/Rocket.Chat","slug":"error-invalid-subscription-9d6959","errorCode":"error-invalid-subscription","errorMessage":"Invalid subscription","messagePattern":"Invalid subscription","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/meteor-methods/users/ignoreUser.ts","lineNumber":26,"sourceCode":"\ndeclare module '@rocket.chat/ddp-client' {\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\tinterface ServerMethods {\n\t\tignoreUser(params: { rid: string; userId: string; ignore?: boolean }): boolean;\n\t}\n}\n\nexport const ignoreUser = async (\n\tfromUserId: string,\n\t{ rid, userId: ignoredUser, ignore }: { rid: string; userId: string; ignore?: boolean },\n): Promise<boolean> => {\n\tconst [subscription, subscriptionIgnoredUser] = await Promise.all([\n\t\tSubscriptions.findOneByRoomIdAndUserId(rid, fromUserId),\n\t\tSubscriptions.findOneByRoomIdAndUserId(rid, ignoredUser),\n\t]);\n\n\tif (!subscription) {\n\t\tthrow new Meteor.Error('error-invalid-subscription', 'Invalid subscription', {\n\t\t\tmethod: 'ignoreUser',\n\t\t});\n\t}\n\n\tif (!subscriptionIgnoredUser) {\n\t\tthrow new Meteor.Error('error-invalid-subscription', 'Invalid subscription', {\n\t\t\tmethod: 'ignoreUser',\n\t\t});\n\t}\n\n\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};","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/meteor-methods/users/ignoreUser.ts#L8-L44","documentation":"In the ignoreUser helper, Subscriptions.findOneByRoomIdAndUserId(rid, fromUserId) found nothing: the calling user has no subscription (membership) record in that room. The method refuses to apply an ignore in a room the caller does not belong to; both caller and target must be members.","triggerScenarios":"Ignoring a user in a room the caller never joined, left, or was removed from; passing a rid from a different room than the one currently displayed.","commonSituations":"Stale UI passing an old rid after the user switched rooms; ignore actions offered from global search results where the room context is wrong; subscription purged when the user left the room.","solutions":["Join/rejoin the room before using ignore within it","Pass the rid of the room currently open and verify the caller's subscription exists first","Refresh room subscriptions before showing the ignore action"],"exampleFix":"// before\nMeteor.callAsync('ignoreUser', { rid, userId: ignoredUser, ignore: true });\n\n// after\nconst mySub = Subscriptions.findOne({ rid });\nif (!mySub) {\n\tshowNotice('join the room before ignoring users here');\n\treturn;\n}\nawait Meteor.callAsync('ignoreUser', { rid, userId: ignoredUser, ignore: true });","handlingStrategy":"validation","validationCode":"const mySub = Subscriptions.findOne({ rid });\nif (!mySub) {\n\tshowNotice('You are not a member of this room');\n\treturn;\n}\nawait Meteor.callAsync('ignoreUser', { rid, userId: ignoredUser, 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-subscription') {\n\t\t// caller's membership missing — refresh subscriptions or rejoin\n\t}\n}","preventionTips":["Offer the ignore action only in rooms the user is subscribed to","Pass the rid of the currently open room, not a cached one","Refresh subscriptions after join/leave transitions before enabling room actions"],"tags":["meteor","rooms","subscriptions","ignore","members"],"backgroundTag":"subscription-not-found","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}