RocketChat/Rocket.Chat · error · Error
error-importer-not-defined
Error message
error-importer-not-defined
What it means
ImportService.run() resolves the importer implementation for the operation with Importers.get(importerKey), where importerKey is stored on the Import document (values like 'csv', 'slack', 'hipchat-enterprise'). If no importer is registered under that key, get() returns undefined and the service throws error-importer-not-defined: the operation record points at an importer this server build does not know.
Source
Thrown at apps/meteor/server/services/import/service.ts:168
await Imports.increaseTotalCount(operation._id, 'users', users.length);
await Imports.setOperationStatus(operation._id, 'importer_user_selection');
}
public async run(userId: string): Promise<void> {
const operation = await Imports.findLastImport();
if (!operation?.valid) {
throw new Error('error-operation-not-found');
}
if (operation.status !== 'importer_user_selection') {
throw new Error('error-invalid-operation-status');
}
const { importerKey } = operation;
const importer = Importers.get(importerKey);
if (!importer) {
throw new Error('error-importer-not-defined');
}
// eslint-disable-next-line new-cap
const instance = new importer.importer(importer, operation, {
skipUserCallbacks: true,
skipDefaultChannels: true,
enableEmail2fa: settings.get<boolean>('Accounts_TwoFactorAuthentication_By_Email_Auto_Opt_In'),
quickUserInsertion: true,
skipExistingUsers: true,
});
await instance.startImport({ users: { all: true } }, userId);
}
}
View on GitHub (pinned to b2c16d5842)
Solutions
- Inspect the last Imports document (db.imports.find().sort({_id: -1}).limit(1)) and compare its importerKey against the importers offered in the import UI
- Re-create the import from scratch using a currently registered importer instead of resuming the stale operation
- If a custom importer was uninstalled, reinstall/register it before resuming the operation
- Delete the stale import operation so the wizard starts clean
Example fix
// before
await importService.run(userId); // error-importer-not-defined
// after
const { importerKey } = operation;
if (!Importers.get(importerKey)) {
throw new Error(`Importer '${importerKey}' is not registered on this server; restart the import with a supported importer`);
}
await importService.run(userId); Defensive patterns
Strategy: validation
Validate before calling
const importer = Importers.get(operation.importerKey);
if (!importer) {
// do not call run(); pick a registered importer instead
throw new Error(`Importer '${operation.importerKey}' is not registered on this server`);
} Type guard
const isRegisteredImporter = (key: string): boolean => Boolean(Importers.get(key));
Try / catch
try {
await importService.run(userId);
} catch (err) {
if (err instanceof Error && err.message === 'error-importer-not-defined') {
// restart the import with a supported importer; resuming this operation will keep failing
return restartImportWithSupportedImporter();
}
throw err;
} Prevention
- After server upgrades, verify importer keys on pending Import records still exist in the registry
- Do not hand-edit importerKey in the database
- Reinstall custom importers before resuming imports that used them
When it happens
Trigger: The Imports document carries an importerKey that is absent from the Importers registry — an importer removed or renamed in a newer Rocket.Chat version, a manually edited/migrated Mongo record, or a community/custom importer that is no longer installed when the import is resumed.
Common situations: Upgrading Rocket.Chat across versions where importer keys changed; resuming an old import after uninstalling the importer; inconsistent database records after manual edits or migrations.
Related errors
- error-importer-not-defined
- error-import-operation-invalid
- error-invalid-user
- error-action-not-allowed
- error-operation-not-found
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/7136bf952c485582.
Report an issue: GitHub.