{"record":{"id":"7136bf952c485582","repo":"RocketChat/Rocket.Chat","slug":"error-importer-not-defined-7136bf","errorCode":null,"errorMessage":"error-importer-not-defined","messagePattern":"error-importer-not-defined","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/services/import/service.ts","lineNumber":168,"sourceCode":"\n\t\tawait Imports.increaseTotalCount(operation._id, 'users', users.length);\n\t\tawait Imports.setOperationStatus(operation._id, 'importer_user_selection');\n\t}\n\n\tpublic async run(userId: string): Promise<void> {\n\t\tconst operation = await Imports.findLastImport();\n\t\tif (!operation?.valid) {\n\t\t\tthrow new Error('error-operation-not-found');\n\t\t}\n\n\t\tif (operation.status !== 'importer_user_selection') {\n\t\t\tthrow new Error('error-invalid-operation-status');\n\t\t}\n\n\t\tconst { importerKey } = operation;\n\t\tconst importer = Importers.get(importerKey);\n\t\tif (!importer) {\n\t\t\tthrow new Error('error-importer-not-defined');\n\t\t}\n\n\t\t// eslint-disable-next-line new-cap\n\t\tconst instance = new importer.importer(importer, operation, {\n\t\t\tskipUserCallbacks: true,\n\t\t\tskipDefaultChannels: true,\n\t\t\tenableEmail2fa: settings.get<boolean>('Accounts_TwoFactorAuthentication_By_Email_Auto_Opt_In'),\n\t\t\tquickUserInsertion: true,\n\t\t\tskipExistingUsers: true,\n\t\t});\n\n\t\tawait instance.startImport({ users: { all: true } }, userId);\n\t}\n}\n","sourceCodeStart":150,"sourceCodeEnd":183,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/services/import/service.ts#L150-L183","documentation":"ImportService.run() resolves the importer implementation for the operation with Importers.get(importerKey), where importerKey is stored on the Import document (values like 'csv', 'slack', 'hipchat-enterprise'). If no importer is registered under that key, get() returns undefined and the service throws error-importer-not-defined: the operation record points at an importer this server build does not know.","triggerScenarios":"The Imports document carries an importerKey that is absent from the Importers registry — an importer removed or renamed in a newer Rocket.Chat version, a manually edited/migrated Mongo record, or a community/custom importer that is no longer installed when the import is resumed.","commonSituations":"Upgrading Rocket.Chat across versions where importer keys changed; resuming an old import after uninstalling the importer; inconsistent database records after manual edits or migrations.","solutions":["Inspect the last Imports document (db.imports.find().sort({_id: -1}).limit(1)) and compare its importerKey against the importers offered in the import UI","Re-create the import from scratch using a currently registered importer instead of resuming the stale operation","If a custom importer was uninstalled, reinstall/register it before resuming the operation","Delete the stale import operation so the wizard starts clean"],"exampleFix":"// before\nawait importService.run(userId); // error-importer-not-defined\n\n// after\nconst { importerKey } = operation;\nif (!Importers.get(importerKey)) {\n  throw new Error(`Importer '${importerKey}' is not registered on this server; restart the import with a supported importer`);\n}\nawait importService.run(userId);","handlingStrategy":"validation","validationCode":"const importer = Importers.get(operation.importerKey);\nif (!importer) {\n  // do not call run(); pick a registered importer instead\n  throw new Error(`Importer '${operation.importerKey}' is not registered on this server`);\n}","typeGuard":"const isRegisteredImporter = (key: string): boolean => Boolean(Importers.get(key));","tryCatchPattern":"try {\n  await importService.run(userId);\n} catch (err) {\n  if (err instanceof Error && err.message === 'error-importer-not-defined') {\n    // restart the import with a supported importer; resuming this operation will keep failing\n    return restartImportWithSupportedImporter();\n  }\n  throw err;\n}","preventionTips":["After server upgrades, verify importer keys on pending Import records still exist in the registry","Do not hand-edit importerKey in the database","Reinstall custom importers before resuming imports that used them"],"tags":["import","registry","importer","rocket-chat"],"backgroundTag":"unknown-provider-key","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"}