{"record":{"id":"d489ea1c1a804ab4","repo":"RocketChat/Rocket.Chat","slug":"error-room-type-not-allowed","errorCode":"error-room-type-not-allowed","errorMessage":"Cannot create invite links for this room type","messagePattern":"Cannot create invite links for this room type","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/lib/rooms/invites/findOrCreateInvite.ts","lineNumber":74,"sourceCode":"\t}\n\n\tconst room = await Rooms.findOneById(invite.rid);\n\tif (!room) {\n\t\tthrow new Meteor.Error('error-invalid-room', 'The rid field is invalid', {\n\t\t\tmethod: 'findOrCreateInvite',\n\t\t\tfield: 'rid',\n\t\t});\n\t}\n\n\tif (settings.get('ABAC_Enabled') && room?.abacAttributes?.length) {\n\t\tthrow new Meteor.Error('error-invalid-room', 'Room is ABAC managed', {\n\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.","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/lib/rooms/invites/findOrCreateInvite.ts#L56-L92","documentation":"Error \"Cannot create invite links for this room type\" thrown in RocketChat/Rocket.Chat.","triggerScenarios":"Thrown when findOrCreateInvite is called for a room type that does not support invite links (e.g. direct messages or other non-channel/group types).","commonSituations":"See trigger scenarios.","solutions":["Only create invite links for channels and groups; direct messages and other room types do not support invite links.","Check room.t before calling findOrCreateInvite and reject unsupported types early."],"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"}