RocketChat/Rocket.Chat · error · Meteor.Error

error-import-file-missing

error-import-file-missing

Error message

fileUrl

What it means

Error "fileUrl" thrown in RocketChat/Rocket.Chat.

Source

Thrown at apps/meteor/server/meteor-methods/import/downloadPublicImportFile.ts:51

function copyLocalFile(filePath: fs.PathLike, writeStream: fs.WriteStream): void {
	const readStream = fs.createReadStream(filePath);
	readStream.pipe(writeStream);
}

export const executeDownloadPublicImportFile = async (userId: IUser['_id'], fileUrl: string, importerKey: string): Promise<void> => {
	const importer = Importers.get(importerKey);
	const isUrl = fileUrl.startsWith('http');
	if (!importer) {
		throw new Meteor.Error(
			'error-importer-not-defined',
			`The importer (${importerKey}) has no import class defined.`,
			'downloadImportFile',
		);
	}
	// Check if it's a valid url or path before creating a new import record
	if (!isUrl && !fs.existsSync(fileUrl)) {
		throw new Meteor.Error('error-import-file-missing', fileUrl, 'downloadPublicImportFile');
	}

	const operation = await Import.newOperation(userId, importer.name, importer.key);
	const instance = new importer.importer(importer, operation); // eslint-disable-line new-cap

	const oldFileName = fileUrl.substring(fileUrl.lastIndexOf('/') + 1).split('?')[0];
	const date = new Date();
	const dateStr = `${date.getUTCFullYear()}${date.getUTCMonth()}${date.getUTCDate()}${date.getUTCHours()}${date.getUTCMinutes()}${date.getUTCSeconds()}`;
	const newFileName = `${dateStr}_${userId}_${oldFileName}`;

	// Store the file name on the imports collection
	await instance.startFileUpload(newFileName);
	await instance.updateProgress(ProgressStep.DOWNLOADING_FILE);

	const writeStream = RocketChatImportFileInstance.createWriteStream(newFileName);
	let errorProgressUpdate: Promise<unknown> | undefined;
	const markImportAsFailed = (): Promise<unknown> => {
		errorProgressUpdate ??= instance.updateProgress(ProgressStep.ERROR).catch((error) => {

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Provide a fileUrl that is either an http(s) URL or an existing local file path; the given value was neither a URL nor a path present on disk (fs.existsSync failed).
  2. Verify the file was uploaded to the server and the path is correct.

When it happens

Trigger: Thrown at apps/meteor/server/meteor-methods/import/downloadPublicImportFile.ts:51 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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