{"record":{"id":"a78ce6dda7017b12","repo":"RocketChat/Rocket.Chat","slug":"error-importer-not-defined-a78ce6","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/getImportProgress.ts","lineNumber":19,"sourceCode":"import type { IImportProgress } from '@rocket.chat/core-typings';\nimport type { ServerMethods } from '@rocket.chat/ddp-client';\nimport { Imports } from '@rocket.chat/models';\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 executeGetImportProgress = async (): Promise<IImportProgress> => {\n\tconst operation = await Imports.findLastImport();\n\tif (!operation) {\n\t\tthrow new Meteor.Error('error-operation-not-found', 'Import Operation Not Found', 'getImportProgress');\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.`, 'getImportProgress');\n\t}\n\n\tconst instance = new importer.importer(importer, operation); // eslint-disable-line new-cap\n\n\treturn instance.getProgress();\n};\n\ndeclare module '@rocket.chat/ddp-client' {\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\tinterface ServerMethods {\n\t\tgetImportProgress(): IImportProgress;\n\t}\n}\n\nMeteor.methods<ServerMethods>({\n\tasync getImportProgress() {\n\t\tmethodDeprecationLogger.method('getImportProgress', '9.0.0', '/v1/getImportProgress');\n\t\tconst userId = Meteor.userId();","sourceCodeStart":1,"sourceCodeEnd":37,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/meteor-methods/import/getImportProgress.ts#L1-L37","documentation":"Same registry mismatch as in getImportFileData, but surfaced by getImportProgress: the latest `imports` document names an `importerKey` for which `Importers.get(importerKey)` returns undefined, so no importer class can be instantiated and progress cannot be read. The data was created by a deployment/importer this server does not register.","triggerScenarios":"Calling `Meteor.call('getImportProgress')` when the last operation's importerKey is not among the server-registered keys ('csv', 'slack', 'slack-users', 'api', 'omnichannel_contact') — e.g. after migrating the database from another version/edition.","commonSituations":"DB restored onto a build without that importer; very old operations left in the collection from before an upgrade; mixed replicas running different feature sets writing to the same database.","solutions":["Check the last operation's importerKey: `db.imports.find().sort({ _updatedAt: -1 }).limit(1)`","Remove the stale operation document and begin a new import with a currently registered key via uploadImportFile","Confirm the importer is registered on this server build before relying on old operations","Use POST /v1/getImportProgress on 9.x instead of the deprecated method"],"exampleFix":"// before\nMeteor.call('getImportProgress', cb); // error-importer-not-defined\n\n// after — clear stale doc, start fresh, then poll\n// (mongo) db.imports.deleteOne({ importerKey: 'no-longer-registered-key' })\nMeteor.call('uploadImportFile', binaryContent, 'text/csv', 'users.csv', 'csv');\nMeteor.call('getImportProgress', 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    // stale operation — clear before polling progress\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  const p = await meteorCall('getImportProgress');\n} catch (e) {\n  if (e instanceof Meteor.Error && e.error === 'error-importer-not-defined') {\n    // stale importerKey in DB: clear operation, restart import\n  }\n}","preventionTips":["Scrub the imports collection when migrating databases between builds","Do not assume old operations remain resumable across upgrades","Log importerKey whenever starting an import to make later mismatches diagnosable"],"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"}