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

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.

Source

Thrown at apps/meteor/server/meteor-methods/import/getImportProgress.ts:19

import type { IImportProgress } from '@rocket.chat/core-typings';
import type { ServerMethods } from '@rocket.chat/ddp-client';
import { Imports } from '@rocket.chat/models';
import { Meteor } from 'meteor/meteor';

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

export const executeGetImportProgress = async (): Promise<IImportProgress> => {
	const operation = await Imports.findLastImport();
	if (!operation) {
		throw new Meteor.Error('error-operation-not-found', 'Import Operation Not Found', 'getImportProgress');
	}

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

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

	return instance.getProgress();
};

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

Meteor.methods<ServerMethods>({
	async getImportProgress() {
		methodDeprecationLogger.method('getImportProgress', '9.0.0', '/v1/getImportProgress');
		const userId = Meteor.userId();

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Check the last operation's importerKey: `db.imports.find().sort({ _updatedAt: -1 }).limit(1)`
  2. Remove the stale operation document and begin a new import with a currently registered key via uploadImportFile
  3. Confirm the importer is registered on this server build before relying on old operations
  4. Use POST /v1/getImportProgress on 9.x instead of the deprecated method

Example fix

// before
Meteor.call('getImportProgress', cb); // error-importer-not-defined

// after — clear stale doc, start fresh, then poll
// (mongo) db.imports.deleteOne({ importerKey: 'no-longer-registered-key' })
Meteor.call('uploadImportFile', binaryContent, 'text/csv', 'users.csv', 'csv');
Meteor.call('getImportProgress', 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)) {
    // stale operation — clear before polling progress
  }
});

Type guard

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

Try / catch

try {
  const p = await meteorCall('getImportProgress');
} catch (e) {
  if (e instanceof Meteor.Error && e.error === 'error-importer-not-defined') {
    // stale importerKey in DB: clear operation, restart import
  }
}

Prevention

When it happens

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

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

Related errors


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