RocketChat/Rocket.Chat · error · Meteor.Error
error-archived-duplicate-name
error-archived-duplicate-name
Error message
There's an archived channel with name ${cleanName} What it means
In the UI_Allow_room_names_with_special_chars path, getValidRoomName slugifies the display name (limax, maintainCase) and looks up Rooms.findOneByDisplayName(displayName); a different room (room._id !== rid) with the same display name exists and its archived flag is set. Archived duplicates get a dedicated code so callers can offer 'unarchive' instead of 'rename'. Details carry function: 'RocketChat.getValidRoomName' and channel_name.
Source
Thrown at apps/meteor/server/lib/utils/lib/getValidRoomName.ts:18
import { Rooms } from '@rocket.chat/models';
import { escapeHTML } from '@rocket.chat/tools';
import limax from 'limax';
import { Meteor } from 'meteor/meteor';
import { settings } from '../../../settings';
import { validateName } from '../../shared/validateName';
export const getValidRoomName = async (displayName: string, rid = '', options: { allowDuplicates?: boolean } = {}) => {
let slugifiedName = displayName;
if (settings.get('UI_Allow_room_names_with_special_chars')) {
const cleanName = limax(displayName, { maintainCase: true });
if (options.allowDuplicates !== true) {
const room = await Rooms.findOneByDisplayName(displayName);
if (room && room._id !== rid) {
if (room.archived) {
throw new Meteor.Error('error-archived-duplicate-name', `There's an archived channel with name ${cleanName}`, {
function: 'RocketChat.getValidRoomName',
channel_name: cleanName,
});
} else {
throw new Meteor.Error('error-duplicate-channel-name', `A channel with name '${cleanName}' exists`, {
function: 'RocketChat.getValidRoomName',
channel_name: cleanName,
});
}
}
}
slugifiedName = cleanName;
}
let nameValidation;
try {
nameValidation = new RegExp(`^${settings.get('UTF8_Channel_Names_Validation')}$`);View on GitHub (pinned to b2c16d5842)
Solutions
- Unarchive the existing channel and reuse it
- Delete the archived channel if it is truly dead, then retry the create
- If the flow genuinely permits duplicate display names, pass { allowDuplicates: true } to getValidRoomName
Example fix
// before
await getValidRoomName('quarterly-reports'); // archived duplicate exists
// after
await getValidRoomName('quarterly-reports', '', { allowDuplicates: true }); Defensive patterns
Strategy: validation
Validate before calling
import { Rooms } from '@rocket.chat/models';
const existing = await Rooms.findOneByDisplayName(displayName);
if (existing && existing._id !== rid && existing.archived) {
// offer 'unarchive <name>' instead of creating
} Try / catch
try {
await getValidRoomName(name, rid);
} catch (error) {
if (error instanceof Meteor.Error && error.error === 'error-archived-duplicate-name') {
// suggest unarchiving the channel named in error.details.channel_name
} else {
throw error;
}
} Prevention
- Check for archived namesakes before presenting create as available
- Prefer unarchive over recreate for retention continuity
- Read channel_name from error details to drive the unarchive prompt
When it happens
Trigger: Creating or renaming a channel to the display name of an archived channel while options.allowDuplicates is not true.
Common situations: Teams recreating archived channels instead of unarchiving them; retention policies that keep archived channels around forever; imports that archive name-colliding rooms.
Related errors
- error-duplicate-channel-name
- error-invalid-room-name
- error-room-archived
- duplicated-account
- room_is_archived
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/08f8769ea6b8930a.
Report an issue: GitHub.