{"record":{"id":"10903c19c0180912","repo":"RocketChat/Rocket.Chat","slug":"error-importer-not-defined-10903c","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/startImport.ts","lineNumber":20,"sourceCode":"import type { ServerMethods } from '@rocket.chat/ddp-client';\nimport { Imports } from '@rocket.chat/models';\nimport { isStartImportParamsPOST, type StartImportParamsPOST } from '@rocket.chat/rest-typings';\nimport { Meteor } from 'meteor/meteor';\n\nimport { hasPermissionAsync } from '../../lib/authorization/hasPermission';\nimport { methodDeprecationLogger } from '../../lib/deprecationWarningLogger';\nimport { Importers } from '../../lib/import';\n\nexport const executeStartImport = async ({ input }: StartImportParamsPOST, startedByUserId: IUser['_id']) => {\n\tconst operation = await Imports.findLastImport();\n\tif (!operation) {\n\t\tthrow new Meteor.Error('error-operation-not-found', 'Import Operation Not Found', 'startImport');\n\t}\n\n\tconst { importerKey } = operation;\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.`, 'startImport');\n\t}\n\n\tconst instance = new importer.importer(importer, operation); // eslint-disable-line new-cap\n\n\tawait instance.startImport(input, startedByUserId);\n};\n\ndeclare module '@rocket.chat/ddp-client' {\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\tinterface ServerMethods {\n\t\tstartImport(params: StartImportParamsPOST): void;\n\t}\n}\n\nMeteor.methods<ServerMethods>({\n\tasync startImport({ input }: StartImportParamsPOST) {\n\t\tmethodDeprecationLogger.method('startImport', '9.0.0', '/v1/startImport');\n\t\tif (!input || typeof input !== 'object' || !isStartImportParamsPOST({ input })) {","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/meteor-methods/import/startImport.ts#L2-L38","documentation":"startImport resolves the last operation's importerKey through the `Importers` registry; an unregistered key throws error-importer-not-defined before `instance.startImport(...)` can run. The stored importerKey does not match any importer class on the current server.","triggerScenarios":"Executing `Meteor.call('startImport', ...)` when the latest `imports` document was produced by a server that registered an importer this build does not (e.g. 'slack-users' vs custom key, or a stripped enterprise build).","commonSituations":"Database migrated between Rocket.Chat versions/editions with different importer registration; leftover operations from ancient imports; trying to resume an import started through a custom importer after removing the app that registered it.","solutions":["Inspect the newest imports document and its importerKey (`db.imports.find().sort({ _updatedAt: -1 }).limit(1)`)","Delete the stale operation and redo the import end-to-end with a registered key (csv, slack, slack-users)","Verify importer registration on the target server before migrating databases"],"exampleFix":"// before\nMeteor.call('startImport', { input }, cb); // error-importer-not-defined\n\n// after — reset and re-run with a registered importer\n// (mongo) db.imports.deleteOne({ importerKey: 'unknown-key' })\nMeteor.call('uploadImportFile', binaryContent, 'text/csv', 'users.csv', 'csv');\nMeteor.call('startImport', { input }, cb);","handlingStrategy":"try-catch","validationCode":"Meteor.call('getLatestImportOperations', (e, ops) => {\n  const KNOWN = ['csv', 'slack', 'slack-users', 'api', 'omnichannel_contact'];\n  if (!ops?.[0] || !KNOWN.includes(ops[0].importerKey)) {\n    // do not call startImport on a stale operation\n  }\n});","typeGuard":"const isKnownImporterKey = (key: string | undefined): key is string =>\n  !!key && ['csv', 'slack', 'slack-users', 'api', 'omnichannel_contact'].includes(key);","tryCatchPattern":"try {\n  await meteorCall('startImport', { input });\n} catch (e) {\n  if (e instanceof Meteor.Error && e.error === 'error-importer-not-defined') {\n    // stale importerKey stored — clear doc and re-upload\n  }\n}","preventionTips":["Clean imports collection after cross-version database restores","Keep imports on the same deployment that created them","Verify importerKey exists before exposing a Resume button"],"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"}