{"record":{"id":"c1203ad09e4ce629","repo":"RocketChat/Rocket.Chat","slug":"importer-channel-missing-users","errorCode":null,"errorMessage":"importer-channel-missing-users","messagePattern":"importer-channel-missing-users","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/lib/import/classes/converters/RoomConverter.ts","lineNumber":105,"sourceCode":"\t\tif ((roomData._id as string).toUpperCase() === 'GENERAL' && roomData.name !== room.name) {\n\t\t\tawait saveRoomSettings(startedByUserId, 'GENERAL', 'roomName', roomData.name);\n\t\t}\n\n\t\tawait this.updateRoomId(room._id, roomData);\n\t}\n\n\tasync insertRoom(roomData: IImportChannel, startedByUserId: string): Promise<void> {\n\t\t// Find the rocketchatId of the user who created this channel\n\t\tconst creatorId = await this.getRoomCreatorId(roomData, startedByUserId);\n\t\tconst members = await this._cache.convertImportedIdsToUsernames(roomData.users, roomData.t !== 'd' ? creatorId : undefined);\n\n\t\tif (roomData.t === 'd') {\n\t\t\tif (members.length < roomData.users.length) {\n\t\t\t\tthis._logger.warn({\n\t\t\t\t\tmsg: 'One or more imported users not found',\n\t\t\t\t\tusers: roomData.users,\n\t\t\t\t});\n\t\t\t\tthrow new Error('importer-channel-missing-users');\n\t\t\t}\n\t\t}\n\n\t\t// Create the channel\n\t\ttry {\n\t\t\tlet roomInfo;\n\t\t\tif (roomData.t === 'd') {\n\t\t\t\troomInfo = await createDirectMessage(members, startedByUserId, true);\n\t\t\t} else {\n\t\t\t\tif (!roomData.name) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (roomData.t === 'p') {\n\t\t\t\t\tconst user = await Users.findOneById(creatorId);\n\t\t\t\t\tif (!user) {\n\t\t\t\t\t\tthrow new Error('importer-channel-invalid-creator');\n\t\t\t\t\t}\n\t\t\t\t\troomInfo = await createPrivateGroupMethod(user, roomData.name, members, false, {}, {});","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/lib/import/classes/converters/RoomConverter.ts#L87-L123","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Fix the user stage first: re-run or complete the users import so DM members resolve","Re-export including all DM participants (both sides of each DM must be in the user data)","If a participant is intentionally absent, drop those DM records before importing instead of failing mid-run","Check the import log for the paired 'One or more imported users not found' entry listing exactly which ids failed to resolve"],"exampleFix":"// pre-flight: only import DMs whose members are all known\nconst knownUserIds = new Set(users.map((u) => u._id));\nconst importableRooms = rooms.filter((room) => room.t !== 'd' || room.users.every((id) => knownUserIds.has(id)));","handlingStrategy":"validation","validationCode":"const knownUserIds = new Set(users.map((u) => u._id));\nconst canImportDirectRoom = (room: IImportChannel): boolean =>\n  room.t !== 'd' || room.users.every((id) => knownUserIds.has(id));","typeGuard":null,"tryCatchPattern":"try {\n  await roomConverter.insertRoom(roomData, startedByUserId);\n} catch (error) {\n  if ((error as Error).message === 'importer-channel-missing-users') {\n    logger.warn({ msg: 'skipping DM with unresolvable members', users: roomData.users });\n    return; // skip this DM, keep importing the other rooms\n  }\n  throw error;\n}","preventionTips":["Import users completely before the rooms pass","Pre-filter DMs whose participants are not in the user set","Track skipped rooms and re-import them after fixing the user data"],"tags":["importer","direct-messages","user-mapping","data-integrity"],"backgroundTag":"import-missing-user-reference","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}