{"record":{"id":"6f4a3a6135548b2c","repo":"RocketChat/Rocket.Chat","slug":"error-importer-not-defined-6f4a3a","errorCode":"error-importer-not-defined","errorMessage":"The importer (${importerKey}) has no import class defined.","messagePattern":"The importer \\((.+?)\\) has no import class defined\\.","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/meteor-methods/import/getImportFileData.ts","lineNumber":25,"sourceCode":"import { Meteor } from 'meteor/meteor';\n\nimport { ProgressStep } from '../../../app/importer/lib/ImporterProgressStep';\nimport { hasPermissionAsync } from '../../lib/authorization/hasPermission';\nimport { methodDeprecationLogger } from '../../lib/deprecationWarningLogger';\nimport { Importers } from '../../lib/import';\nimport { RocketChatImportFileInstance } from '../../lib/import/startup/store';\n\nexport const executeGetImportFileData = async (): Promise<IImporterSelection | { waiting: true }> => {\n\tconst operation = await Imports.findLastImport();\n\tif (!operation) {\n\t\tthrow new Meteor.Error('error-operation-not-found', 'Import Operation Not Found', 'getImportFileData');\n\t}\n\n\tconst { importerKey } = operation;\n\n\tconst importer = Importers.get(importerKey);\n\tif (!importer) {\n\t\tthrow new Meteor.Error('error-importer-not-defined', `The importer (${importerKey}) has no import class defined.`, 'getImportFileData');\n\t}\n\n\tconst instance = new importer.importer(importer, operation); // eslint-disable-line new-cap\n\n\tconst waitingSteps: IImportProgress['step'][] = [\n\t\tProgressStep.DOWNLOADING_FILE,\n\t\tProgressStep.PREPARING_CHANNELS,\n\t\tProgressStep.PREPARING_MESSAGES,\n\t\tProgressStep.PREPARING_USERS,\n\t\tProgressStep.PREPARING_CONTACTS,\n\t\tProgressStep.PREPARING_STARTED,\n\t];\n\n\tif (waitingSteps.indexOf(instance.progress.step) >= 0) {\n\t\tif (instance.importRecord?.valid) {\n\t\t\treturn { waiting: true };\n\t\t}\n\t\tthrow new Meteor.Error('error-import-operation-invalid', 'Invalid Import Operation', 'getImportFileData');","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/meteor-methods/import/getImportFileData.ts#L7-L43","documentation":"Thrown by the getImportFileData Meteor method when the most recent record in the `imports` collection stores an `importerKey` that has no entry in the server's `Importers` registry (`Importers.get(importerKey)` returned undefined). Rocket.Chat therefore cannot construct an importer instance to read the uploaded file. The operation document exists, but the class able to process it is not registered on this server.","triggerScenarios":"Calling `Meteor.call('getImportFileData')` (or POST /v1/getImportFileData) when `Imports.findLastImport()` returns an operation whose importerKey is not one of the registered keys ('csv', 'slack', 'slack-users', 'api', 'omnichannel_contact'). Happens when the imports collection was written by a different server build, a deployment that no longer registers that importer, or a hand-edited DB row.","commonSituations":"Restoring a MongoDB dump onto a different Rocket.Chat version or edition (e.g. a build where the importer was removed); leftover operations from an old failed import attempt surfacing after upgrade to 9.x; database migrated between environments where importer registration differs.","solutions":["Inspect the last operation: `db.imports.find().sort({ _updatedAt: -1 }).limit(1)` and compare its `importerKey` against the registered keys ('csv', 'slack', 'slack-users', 'api', 'omnichannel_contact')","Delete the stale `imports` document (or finish/cancel the old import from Administration > Import) so findLastImport() no longer returns it, then re-upload the file via uploadImportFile with a valid importerKey","Verify your server build registers the importer you need (a stock community 9.x server registers csv, slack, slack-users)","On 9.x prefer the REST flow: POST /v1/uploadImportFile then POST /v1/getImportFileData"],"exampleFix":"// before\nMeteor.call('getImportFileData', (err, data) => { /* throws error-importer-not-defined */ });\n\n// after — clear the stale operation, then start a fresh import with a registered key\n// (mongo) db.imports.deleteOne({ _id: '<stale operation id>' })\nMeteor.call('uploadImportFile', binaryContent, 'application/zip', 'slack-export.zip', 'slack');\nMeteor.call('getImportFileData', (err, data) => { /* selection or { waiting: true } */ });","handlingStrategy":"try-catch","validationCode":"// Pre-check the stored importerKey before asking for file data (needs view-import-operations)\nMeteor.call('getLatestImportOperations', (e, ops) => {\n  const KNOWN = ['csv', 'slack', 'slack-users', 'api', 'omnichannel_contact'];\n  const last = ops?.[0];\n  if (!last || !KNOWN.includes(last.importerKey)) {\n    // stale operation: clear it and re-upload instead of calling getImportFileData\n  }\n});","typeGuard":"const KNOWN_IMPORTERS = new Set(['csv', 'slack', 'slack-users', 'api', 'omnichannel_contact']);\nconst isKnownImporterKey = (key: string | undefined): key is string =>\n  typeof key === 'string' && KNOWN_IMPORTERS.has(key);","tryCatchPattern":"try {\n  const data = await meteorCall('getImportFileData');\n} catch (e) {\n  if (e instanceof Meteor.Error && e.error === 'error-importer-not-defined') {\n    // stale imports doc: surface 'restart the import' UI; do not retry automatically\n  }\n  throw e;\n}","preventionTips":["Never reuse an imports collection written by a different Rocket.Chat build without verifying importerKey values","After restoring a DB dump, clean the imports collection before running the import UI","Treat unknown importerKey as a terminal state — re-upload instead of retrying getImportFileData"],"tags":["rocket-chat","import","importer-registry","meteor-methods"],"backgroundTag":"importer-not-registered","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}