RocketChat/Rocket.Chat · error · Meteor.Error
error-importer-not-defined
error-importer-not-defined
Error message
The importer (${importerKey}) has no import class defined. What it means
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.
Source
Thrown at apps/meteor/server/meteor-methods/import/getImportFileData.ts:25
import { Meteor } from 'meteor/meteor';
import { ProgressStep } from '../../../app/importer/lib/ImporterProgressStep';
import { hasPermissionAsync } from '../../lib/authorization/hasPermission';
import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger';
import { Importers } from '../../lib/import';
import { RocketChatImportFileInstance } from '../../lib/import/startup/store';
export const executeGetImportFileData = async (): Promise<IImporterSelection | { waiting: true }> => {
const operation = await Imports.findLastImport();
if (!operation) {
throw new Meteor.Error('error-operation-not-found', 'Import Operation Not Found', 'getImportFileData');
}
const { importerKey } = operation;
const importer = Importers.get(importerKey);
if (!importer) {
throw new Meteor.Error('error-importer-not-defined', `The importer (${importerKey}) has no import class defined.`, 'getImportFileData');
}
const instance = new importer.importer(importer, operation); // eslint-disable-line new-cap
const waitingSteps: IImportProgress['step'][] = [
ProgressStep.DOWNLOADING_FILE,
ProgressStep.PREPARING_CHANNELS,
ProgressStep.PREPARING_MESSAGES,
ProgressStep.PREPARING_USERS,
ProgressStep.PREPARING_CONTACTS,
ProgressStep.PREPARING_STARTED,
];
if (waitingSteps.indexOf(instance.progress.step) >= 0) {
if (instance.importRecord?.valid) {
return { waiting: true };
}
throw new Meteor.Error('error-import-operation-invalid', 'Invalid Import Operation', 'getImportFileData');View on GitHub (pinned to b2c16d5842)
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
Example fix
// before
Meteor.call('getImportFileData', (err, data) => { /* throws error-importer-not-defined */ });
// after — clear the stale operation, then start a fresh import with a registered key
// (mongo) db.imports.deleteOne({ _id: '<stale operation id>' })
Meteor.call('uploadImportFile', binaryContent, 'application/zip', 'slack-export.zip', 'slack');
Meteor.call('getImportFileData', (err, data) => { /* selection or { waiting: true } */ }); Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-check the stored importerKey before asking for file data (needs view-import-operations)
Meteor.call('getLatestImportOperations', (e, ops) => {
const KNOWN = ['csv', 'slack', 'slack-users', 'api', 'omnichannel_contact'];
const last = ops?.[0];
if (!last || !KNOWN.includes(last.importerKey)) {
// stale operation: clear it and re-upload instead of calling getImportFileData
}
}); Type guard
const KNOWN_IMPORTERS = new Set(['csv', 'slack', 'slack-users', 'api', 'omnichannel_contact']); const isKnownImporterKey = (key: string | undefined): key is string => typeof key === 'string' && KNOWN_IMPORTERS.has(key);
Try / catch
try {
const data = await meteorCall('getImportFileData');
} catch (e) {
if (e instanceof Meteor.Error && e.error === 'error-importer-not-defined') {
// stale imports doc: surface 'restart the import' UI; do not retry automatically
}
throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- error-importer-not-defined
- error-importer-not-defined
- error-importer-not-defined
- error-import-operation-invalid
- error-invalid-user
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/6f4a3a6135548b2c.
Report an issue: GitHub.