{"record":{"id":"48cdb7a605763157","repo":"RocketChat/Rocket.Chat","slug":"invalid-number-of-uses","errorCode":"invalid-number-of-uses","errorMessage":"Invite should be valid for 1, 5, 10, 25, 50, 100 or infinite (0) uses.","messagePattern":"Invite should be valid for 1, 5, 10, 25, 50, 100 or infinite \\(0\\) uses\\.","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/lib/rooms/invites/findOrCreateInvite.ts","lineNumber":86,"sourceCode":"\t\t\tmethod: 'findOrCreateInvite',\n\t\t\tfield: 'rid',\n\t\t});\n\t}\n\n\tif (!(await roomCoordinator.getRoomDirectives(room.t).allowMemberAction(room, RoomMemberActions.INVITE, userId))) {\n\t\tthrow new Meteor.Error('error-room-type-not-allowed', 'Cannot create invite links for this room type', {\n\t\t\tmethod: 'findOrCreateInvite',\n\t\t});\n\t}\n\n\tconst { days = 1, maxUses = 0 } = invite;\n\n\tif (!possibleDays.includes(days)) {\n\t\tthrow new Meteor.Error('invalid-number-of-days', 'Invite should expire in 1, 7, 15 or 30 days, or send 0 to never expire.');\n\t}\n\n\tif (!possibleUses.includes(maxUses)) {\n\t\tthrow new Meteor.Error('invalid-number-of-uses', 'Invite should be valid for 1, 5, 10, 25, 50, 100 or infinite (0) uses.');\n\t}\n\n\t// Before anything, let's check if there's an existing invite with the same settings for the same channel and user and that has not yet expired.\n\tconst existing = await Invites.findOneByUserRoomMaxUsesAndExpiration(userId, invite.rid, maxUses, days);\n\n\t// If an existing invite was found, return it's _id instead of creating a new one.\n\tif (existing) {\n\t\texisting.url = getInviteUrl(existing);\n\t\treturn existing;\n\t}\n\n\tconst _id = Random.id(6);\n\n\t// insert invite\n\tconst createdAt = new Date();\n\tlet expires = null;\n\tif (days > 0) {\n\t\texpires = new Date(createdAt);","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/lib/rooms/invites/findOrCreateInvite.ts#L68-L104","documentation":"Error \"Invite should be valid for 1, 5, 10, 25, 50, 100 or infinite (0) uses.\" thrown in RocketChat/Rocket.Chat.","triggerScenarios":"Thrown when the requested max number of invite uses is not one of the allowed values 1, 5, 10, 25, 50, 100, or 0 (infinite).","commonSituations":"See trigger scenarios.","solutions":["Pass one of the allowed maxUses values: 1, 5, 10, 25, 50, 100, or 0 for unlimited uses."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}