RocketChat/Rocket.Chat · error · Meteor.Error
invalid-number-of-days
invalid-number-of-days
Error message
Invite should expire in 1, 7, 15 or 30 days, or send 0 to never expire.
What it means
Error "Invite should expire in 1, 7, 15 or 30 days, or send 0 to never expire." thrown in RocketChat/Rocket.Chat.
Source
Thrown at apps/meteor/server/lib/rooms/invites/findOrCreateInvite.ts:82
}
if (settings.get('ABAC_Enabled') && room?.abacAttributes?.length) {
throw new Meteor.Error('error-invalid-room', 'Room is ABAC managed', {
method: 'findOrCreateInvite',
field: 'rid',
});
}
if (!(await roomCoordinator.getRoomDirectives(room.t).allowMemberAction(room, RoomMemberActions.INVITE, userId))) {
throw new Meteor.Error('error-room-type-not-allowed', 'Cannot create invite links for this room type', {
method: 'findOrCreateInvite',
});
}
const { days = 1, maxUses = 0 } = invite;
if (!possibleDays.includes(days)) {
throw new Meteor.Error('invalid-number-of-days', 'Invite should expire in 1, 7, 15 or 30 days, or send 0 to never expire.');
}
if (!possibleUses.includes(maxUses)) {
throw new Meteor.Error('invalid-number-of-uses', 'Invite should be valid for 1, 5, 10, 25, 50, 100 or infinite (0) uses.');
}
// 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.
const existing = await Invites.findOneByUserRoomMaxUsesAndExpiration(userId, invite.rid, maxUses, days);
// If an existing invite was found, return it's _id instead of creating a new one.
if (existing) {
existing.url = getInviteUrl(existing);
return existing;
}
const _id = Random.id(6);
// insert inviteView on GitHub (pinned to b2c16d5842)
Solutions
- Pass one of the allowed expire values: 1, 7, 15, 30 days, or 0 for a non-expiring invite.
When it happens
Trigger: Thrown when the requested invite expiration in days is not one of the allowed values 1, 7, 15, 30, or 0 (never expire).
Common situations: See trigger scenarios.
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/83065807c32f5b7a.
Report an issue: GitHub.