RocketChat/Rocket.Chat · error · Meteor.Error
error-room-type-not-archivable
error-room-type-not-archivable
Error message
Room type: ${room.t} can not be archived What it means
Before archiving, /archive consults roomCoordinator.getRoomDirectives(room.t).allowMemberAction(room, ARCHIVE, userId); room types that do not support archiving - by design direct messages ('d') and livechat rooms ('l'), or any custom room type that did not opt in - cause 'error-room-type-not-archivable' with the offending room.t in the message. This is a capability check on the room type, independent of the user's permissions.
Source
Thrown at apps/meteor/server/slashcommands/archiveroom/server.ts:52
}
const user = await Users.findOneById(userId, { projection: { username: 1, name: 1 } });
if (!user || !isRegisterUser(user)) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', { method: 'archiveRoom' });
}
if (!room) {
void api.broadcast('notify.ephemeralMessage', userId, message.rid, {
msg: i18n.t('Channel_doesnt_exist', {
channelName: channel,
lng: settings.get('Language') || 'en',
}),
});
return;
}
if (!(await roomCoordinator.getRoomDirectives(room.t).allowMemberAction(room, RoomMemberActions.ARCHIVE, userId))) {
throw new Meteor.Error('error-room-type-not-archivable', `Room type: ${room.t} can not be archived`);
}
if (!(await hasPermissionAsync(userId, 'archive-room', room._id))) {
throw new Meteor.Error('error-not-authorized', 'Not authorized');
}
if (room.archived) {
void api.broadcast('notify.ephemeralMessage', userId, message.rid, {
msg: i18n.t('Duplicate_archived_channel_name', {
channelName: channel,
lng: settings.get('Language') || 'en',
}),
});
return;
}
await archiveRoom(room._id, user);
View on GitHub (pinned to b2c16d5842)
Solutions
- Use /archive only on channel (c), private group (p) or team rooms - for DMs, hide the conversation instead
- For livechat rooms, close the chat via the omnichannel flow rather than archiving
- If developing a custom room type, implement allowMemberAction to allow (or explicitly forbid) ARCHIVE
- Check room.t in the error message to identify which type rejected the action
Example fix
// before
runSlashCommand('/archive', { rid: directMessageRoomId });
// -> error-room-type-not-archivable: Room type: d can not be archived
// after
const archivable = await roomCoordinator.getRoomDirectives(room.t).allowMemberAction(room, RoomMemberActions.ARCHIVE, userId);
if (!archivable) return notifyUser('This room type cannot be archived; hide it instead');
runSlashCommand('/archive', { rid: room._id }); Defensive patterns
Strategy: validation
Validate before calling
const archivable = await roomCoordinator.getRoomDirectives(room.t).allowMemberAction(room, RoomMemberActions.ARCHIVE, userId);
if (!archivable) {
return notifyUser('This room type cannot be archived');
}
runCommand('/archive', room); Type guard
const isArchivableRoomType = (t: IRoom['t']): boolean => t === 'c' || t === 'p' || t === 't'; // channels, private groups, teams
Try / catch
catch (err) {
if (err instanceof Meteor.Error && err.error === 'error-room-type-not-archivable') {
// read room.t from the message; suggest hiding DMs or closing livechat instead
} else throw err;
} Prevention
- Hide the archive action in DM and livechat UI contexts
- For custom room types, decide archive support when registering directives with roomCoordinator
- Surface the room type in the error UX so users understand the refusal
When it happens
Trigger: Running /archive in a direct message; archiving a livechat room via the slash command; a custom room type registered without an allowMemberAction that permits ARCHIVE.
Common situations: Users expecting DMs to be archivable like channels; omnichannel agents trying to tidy livechat rooms; apps registering custom room types without archive support.
Related errors
- error-not-authorized
- error-room-type-not-unarchivable
- Only channels, private groups and direct messages can be cre
- error-this-is-not-a-livechat-room
- error-not-allowed
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/f676543f22c35534.
Report an issue: GitHub.