RocketChat/Rocket.Chat · error · Error

importer-channel-missing-users

Error message

importer-channel-missing-users

What it means

Thrown by RoomConverter.insertRoom when creating a direct-message room: after converting member ids to usernames via convertImportedIdsToUsernames, fewer members resolved than were declared on the room, so the DM cannot be created faithfully. That room's import fails; the importer continues with other records. A paired log line 'One or more imported users not found' lists the offending user ids.

Source

Thrown at apps/meteor/server/lib/import/classes/converters/RoomConverter.ts:105

		if ((roomData._id as string).toUpperCase() === 'GENERAL' && roomData.name !== room.name) {
			await saveRoomSettings(startedByUserId, 'GENERAL', 'roomName', roomData.name);
		}

		await this.updateRoomId(room._id, roomData);
	}

	async insertRoom(roomData: IImportChannel, startedByUserId: string): Promise<void> {
		// Find the rocketchatId of the user who created this channel
		const creatorId = await this.getRoomCreatorId(roomData, startedByUserId);
		const members = await this._cache.convertImportedIdsToUsernames(roomData.users, roomData.t !== 'd' ? creatorId : undefined);

		if (roomData.t === 'd') {
			if (members.length < roomData.users.length) {
				this._logger.warn({
					msg: 'One or more imported users not found',
					users: roomData.users,
				});
				throw new Error('importer-channel-missing-users');
			}
		}

		// Create the channel
		try {
			let roomInfo;
			if (roomData.t === 'd') {
				roomInfo = await createDirectMessage(members, startedByUserId, true);
			} else {
				if (!roomData.name) {
					return;
				}
				if (roomData.t === 'p') {
					const user = await Users.findOneById(creatorId);
					if (!user) {
						throw new Error('importer-channel-invalid-creator');
					}
					roomInfo = await createPrivateGroupMethod(user, roomData.name, members, false, {}, {});

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Fix the user stage first: re-run or complete the users import so DM members resolve
  2. Re-export including all DM participants (both sides of each DM must be in the user data)
  3. If a participant is intentionally absent, drop those DM records before importing instead of failing mid-run
  4. Check the import log for the paired 'One or more imported users not found' entry listing exactly which ids failed to resolve

Example fix

// pre-flight: only import DMs whose members are all known
const knownUserIds = new Set(users.map((u) => u._id));
const importableRooms = rooms.filter((room) => room.t !== 'd' || room.users.every((id) => knownUserIds.has(id)));
Defensive patterns

Strategy: validation

Validate before calling

const knownUserIds = new Set(users.map((u) => u._id));
const canImportDirectRoom = (room: IImportChannel): boolean =>
  room.t !== 'd' || room.users.every((id) => knownUserIds.has(id));

Try / catch

try {
  await roomConverter.insertRoom(roomData, startedByUserId);
} catch (error) {
  if ((error as Error).message === 'importer-channel-missing-users') {
    logger.warn({ msg: 'skipping DM with unresolvable members', users: roomData.users });
    return; // skip this DM, keep importing the other rooms
  }
  throw error;
}

Prevention

When it happens

Trigger: An imported DM whose member users were never imported (one side deleted their account before export, users.json incomplete, or the users stage failed earlier). Only fires for roomData.t === 'd'; regular channels tolerate missing members.

Common situations: Imports where the users stage was skipped or partially failed; Slack exports whose DM files reference users not in users.json; selective channel imports that also pull in DM records.

Related errors


AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18). Data as JSON: /api/errors/c1203ad09e4ce629. Report an issue: GitHub.