{"record":{"id":"c6aff599f4b22c32","repo":"RocketChat/Rocket.Chat","slug":"error-importer-not-defined-c6aff5","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/uploadImportFile.ts","lineNumber":22,"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';\nimport { RocketChatFile } from '../../lib/media/file';\n\nexport const executeUploadImportFile = async (\n\tuserId: IUser['_id'],\n\tbinaryContent: string,\n\tcontentType: string,\n\tfileName: string,\n\timporterKey: string,\n): Promise<void> => {\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.`, 'uploadImportFile');\n\t}\n\n\tconst operation = await Import.newOperation(userId, importer.name, importer.key);\n\n\tconst instance = new importer.importer(importer, operation); // eslint-disable-line new-cap\n\n\tconst date = new Date();\n\tconst dateStr = `${date.getUTCFullYear()}${date.getUTCMonth()}${date.getUTCDate()}${date.getUTCHours()}${date.getUTCMinutes()}${date.getUTCSeconds()}`;\n\tconst newFileName = `${dateStr}_${userId}_${fileName}`;\n\n\t// Store the file name and content type on the imports collection\n\tawait instance.startFileUpload(newFileName, contentType);\n\n\t// Save the file on the File Store\n\tconst file = Buffer.from(binaryContent, 'base64');\n\tconst readStream = RocketChatFile.bufferToStream(file);\n\tconst writeStream = RocketChatImportFileInstance.createWriteStream(newFileName, contentType);\n","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/meteor-methods/import/uploadImportFile.ts#L4-L40","documentation":"uploadImportFile receives the importerKey as a client-supplied argument and immediately looks it up via `Importers.get(importerKey)`; an unknown key throws error-importer-not-defined before any file is stored. Unlike the findLastImport-based methods, this one fails on the key YOU passed, not on stored data.","triggerScenarios":"Calling `Meteor.call('uploadImportFile', binaryContent, contentType, fileName, importerKey)` with a key not registered on the server — typo ('Slack', 'slackusers'), a key from outdated docs, or an importer this build does not ship (valid public keys: 'csv', 'slack', 'slack-users').","commonSituations":"Hardcoded importer keys drifting from the server's registry; UI selector populated from a stale list; docs/blog examples naming importers removed in newer versions.","solutions":["Use an exact registered key: 'csv', 'slack', or 'slack-users' (keys are case-sensitive)","Populate the importer selector from the server's importer list rather than a hardcoded array","Check registration server-side if unsure: `Importers.get(key)` in a debug shell"],"exampleFix":"// before\nMeteor.call('uploadImportFile', bin, 'text/csv', 'users.csv', 'CSV'); // error-importer-not-defined\n\n// after\nMeteor.call('uploadImportFile', bin, 'text/csv', 'users.csv', 'csv');","handlingStrategy":"validation","validationCode":"const REGISTERED = ['csv', 'slack', 'slack-users'] as const;\nif (!REGISTERED.includes(importerKey as (typeof REGISTERED)[number])) {\n  throw new Error(`Unknown importer key '${importerKey}'; expected one of ${REGISTERED.join(', ')}`);\n}\nMeteor.call('uploadImportFile', binaryContent, contentType, fileName, importerKey);","typeGuard":"const REGISTERED_IMPORTERS = ['csv', 'slack', 'slack-users'] as const;\ntype ImporterKey = (typeof REGISTERED_IMPORTERS)[number];\nconst isImporterKey = (k: string): k is ImporterKey =>\n  (REGISTERED_IMPORTERS as readonly string[]).includes(k);","tryCatchPattern":"Meteor.call('uploadImportFile', bin, type, name, key, (err) => {\n  if (err && (err as Meteor.Error).error === 'error-importer-not-defined') {\n    // the key YOU sent is not registered — fix the key, don't retry blindly\n  }\n});","preventionTips":["Send exact, case-sensitive keys from the server's importer list","Populate the UI selector from GET importer metadata, not a hardcoded array","Centralize importer keys in one constant shared by every upload call site"],"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"}