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

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.

Source

Thrown at apps/meteor/server/meteor-methods/import/startImport.ts:20

import type { ServerMethods } from '@rocket.chat/ddp-client';
import { Imports } from '@rocket.chat/models';
import { isStartImportParamsPOST, type StartImportParamsPOST } from '@rocket.chat/rest-typings';
import { Meteor } from 'meteor/meteor';

import { hasPermissionAsync } from '../../lib/authorization/hasPermission';
import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger';
import { Importers } from '../../lib/import';

export const executeStartImport = async ({ input }: StartImportParamsPOST, startedByUserId: IUser['_id']) => {
	const operation = await Imports.findLastImport();
	if (!operation) {
		throw new Meteor.Error('error-operation-not-found', 'Import Operation Not Found', 'startImport');
	}

	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.`, 'startImport');
	}

	const instance = new importer.importer(importer, operation); // eslint-disable-line new-cap

	await instance.startImport(input, startedByUserId);
};

declare module '@rocket.chat/ddp-client' {
	// eslint-disable-next-line @typescript-eslint/naming-convention
	interface ServerMethods {
		startImport(params: StartImportParamsPOST): void;
	}
}

Meteor.methods<ServerMethods>({
	async startImport({ input }: StartImportParamsPOST) {
		methodDeprecationLogger.method('startImport', '9.0.0', '/v1/startImport');
		if (!input || typeof input !== 'object' || !isStartImportParamsPOST({ input })) {

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Inspect the newest imports document and its importerKey (`db.imports.find().sort({ _updatedAt: -1 }).limit(1)`)
  2. Delete the stale operation and redo the import end-to-end with a registered key (csv, slack, slack-users)
  3. Verify importer registration on the target server before migrating databases

Example fix

// before
Meteor.call('startImport', { input }, cb); // error-importer-not-defined

// after — reset and re-run with a registered importer
// (mongo) db.imports.deleteOne({ importerKey: 'unknown-key' })
Meteor.call('uploadImportFile', binaryContent, 'text/csv', 'users.csv', 'csv');
Meteor.call('startImport', { input }, cb);
Defensive patterns

Strategy: try-catch

Validate before calling

Meteor.call('getLatestImportOperations', (e, ops) => {
  const KNOWN = ['csv', 'slack', 'slack-users', 'api', 'omnichannel_contact'];
  if (!ops?.[0] || !KNOWN.includes(ops[0].importerKey)) {
    // do not call startImport on a stale operation
  }
});

Type guard

const isKnownImporterKey = (key: string | undefined): key is string =>
  !!key && ['csv', 'slack', 'slack-users', 'api', 'omnichannel_contact'].includes(key);

Try / catch

try {
  await meteorCall('startImport', { input });
} catch (e) {
  if (e instanceof Meteor.Error && e.error === 'error-importer-not-defined') {
    // stale importerKey stored — clear doc and re-upload
  }
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18). Data as JSON: /api/errors/10903c19c0180912. Report an issue: GitHub.