{"record":{"id":"b98a12c606cd07cd","repo":"RocketChat/Rocket.Chat","slug":"mentioned-user-not-found","errorCode":null,"errorMessage":"Mentioned user not found","messagePattern":"Mentioned user not found","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"apps/meteor/server/lib/import/classes/converters/MessageConverter.ts","lineNumber":165,"sourceCode":"\t\t\treturn undefined;\n\t\t}\n\n\t\tconst result: MentionedUser[] = [];\n\t\tfor (const importId of mentions) {\n\t\t\tif (importId === ('all' as 'string') || importId === 'here') {\n\t\t\t\tresult.push({\n\t\t\t\t\t_id: importId,\n\t\t\t\t\tusername: importId,\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Loading the name will also store the remaining data on the cache if it's missing, so this won't run two queries\n\t\t\tconst name = await this._cache.findImportedUserDisplayName(importId);\n\t\t\tconst data = await this._cache.findImportedUser(importId);\n\n\t\t\tif (!data) {\n\t\t\t\tthis._logger.warn({ msg: 'Mentioned user not found', importId });\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (!data.username) {\n\t\t\t\tthis._logger.debug({ msg: 'Mentioned user has no username', importId });\n\t\t\t\tthrow new Error('importer-message-mentioned-username-not-found');\n\t\t\t}\n\n\t\t\tmessage.msg = message.msg.replace(new RegExp(`\\@${importId}`, 'gi'), `@${data.username}`);\n\n\t\t\tresult.push({\n\t\t\t\t_id: data._id,\n\t\t\t\tusername: data.username as 'string',\n\t\t\t\tname,\n\t\t\t});\n\t\t}\n\t\treturn result;\n\t}","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/lib/import/classes/converters/MessageConverter.ts#L147-L183","documentation":"During message import, an @mention could not be resolved to an imported user (findImportedUser returned nothing) and the mention is skipped: the user is omitted from the mentions array and the raw imported id remains in the text. Non-fatal. Distinct from importer-message-mentioned-username-not-found, which is thrown when the user DOES resolve but has no username.","triggerScenarios":"Messages mentioning users excluded from the import: bots and deactivated accounts missing from the source export's user list, or users dropped by an earlier partial import.","commonSituations":"Same class as unknown message authors: partial exports, deleted source accounts, bot users omitted from users.json, hand-trimmed export files.","solutions":["Include the mentioned users in the import data (re-export with all users, including bots)","Map missing mentionees to a placeholder user id before importing","After import, sweep message texts for leftover raw mention ids and rewrite or strip them"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const importedUserIds = new Set(users.map((u) => u._id));\nconst sanitizeMentions = (msg: IImportMessage) => ({\n  ...msg,\n  mentions: (msg.mentions ?? []).filter((id) => id === 'all' || id === 'here' || importedUserIds.has(id)),\n});","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure every mentioned id exists in the imported users, including bots","Remember 'all' and 'here' are passthrough; every other id must resolve","Audit imported threads for un-substituted @ids"],"tags":["importer","mentions","users","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"}