RocketChat/Rocket.Chat · error · Meteor.Error
Invalid Selection data provided to the importer.
Error message
Invalid Selection data provided to the importer.
What it means
startImport validates its payload with the ajv type guard `isStartImportParamsPOST` (from @rocket.chat/rest-typings) and throws this message — with no error code — when validation fails. The accepted shape is exactly `{ input: { users?: { all?: boolean; list?: string[] }, channels?: {...}, contacts?: {...} } }`, `input` required, no additional top-level properties.
Source
Thrown at apps/meteor/server/meteor-methods/import/startImport.ts:39
}
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 })) {
throw new Meteor.Error(`Invalid Selection data provided to the importer.`);
}
const userId = Meteor.userId();
// Takes name and object with users / channels selected to import
if (!userId) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', 'startImport');
}
if (!(await hasPermissionAsync(userId, 'run-import'))) {
throw new Meteor.Error('error-action-not-allowed', 'Importing is not allowed', 'startImport');
}
return executeStartImport({ input }, userId);
},
});
View on GitHub (pinned to b2c16d5842)
Solutions
- Send exactly `{ input: { users: { all, list }, channels: { all, list }, contacts: { all, list } } }` with booleans for `all` and string arrays for `list`
- Map the full selection from getImportFileData down to IImporterShortSelection before calling
- Validate client-side first with `isStartImportParamsPOST({ input })` from '@rocket.chat/rest-typings'
Example fix
// before
Meteor.call('startImport', selectionFromGetImportFileData); // 'Invalid Selection data provided to the importer.'
// after
const input = {
users: { all: false, list: selection.users.map((u) => u.user_id) },
channels: { all: true, list: [] },
};
Meteor.call('startImport', { input }); Defensive patterns
Strategy: type-guard
Validate before calling
import { isStartImportParamsPOST } from '@rocket.chat/rest-typings';
const params = { input: { users: { all: false, list: ['u1'] }, channels: { all: true, list: [] } } };
if (!isStartImportParamsPOST(params)) {
// inspect isStartImportParamsPOST.errors and fix payload before calling
}
Meteor.call('startImport', params); Type guard
import { isStartImportParamsPOST } from '@rocket.chat/rest-typings';
const isStartableSelection = (v: unknown): boolean => isStartImportParamsPOST({ input: v }); Try / catch
try {
await meteorCall('startImport', params);
} catch (e) {
if (e instanceof Meteor.Error && e.reason === 'Invalid Selection data provided to the importer.') {
// this error has no code — match on message; log isStartImportParamsPOST.errors
}
} Prevention
- Always wrap the selection as { input: ... } — no extra top-level keys (additionalProperties: false)
- Use only users/channels/contacts, each { all?: boolean, list?: string[] } — list entries are string ids
- Run isStartImportParamsPOST client-side; it is the exact ajv guard the server uses
When it happens
Trigger: Calling `Meteor.call('startImport', payload)` where payload omits `input`, passes extra top-level keys (additionalProperties: false), or puts wrong types inside users/channels/contacts (e.g. `list` as objects instead of string[], `all` as string).
Common situations: Passing the raw selection object from getImportFileData straight through instead of mapping it to the short-selection shape; hand-writing the payload and using `message_ids` or other unlisted keys; older clients sending a shape that the ajv schema later tightened.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
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/18bf69eed84a4032.
Report an issue: GitHub.