RocketChat/Rocket.Chat · error · Error

Invalid path configured for file system App storage

Error message

Invalid path configured for file system App storage

What it means

Thrown by `AppFileSystemSourceStorage.checkPath()` when `this.path` is falsy (never set). The file-system source storage needs a base directory to read/write app bundles; without it, `store`/`update`/`remove` cannot resolve a target filename. It is a configuration error: `setPath()` must be called before any storage operation.

Source

Thrown at apps/meteor/ee/server/apps/storage/AppFileSystemSourceStorage.ts:18

import { promises as fs } from 'node:fs';
import { join, normalize } from 'node:path';

import { AppSourceStorage } from '@rocket.chat/apps/dist/server/storage/AppSourceStorage';
import type { IAppStorageItem } from '@rocket.chat/apps/dist/server/storage/IAppStorageItem';

export class AppFileSystemSourceStorage extends AppSourceStorage {
	private pathPrefix = 'fs:/';

	private path: string;

	public setPath(path: string): void {
		this.path = path;
	}

	public checkPath(): void {
		if (!this.path) {
			throw new Error('Invalid path configured for file system App storage');
		}
	}

	public async store(item: IAppStorageItem, zip: Buffer): Promise<string> {
		this.checkPath();

		const filePath = this.itemToFilename(item);

		await fs.writeFile(filePath, zip);

		return this.filenameToSourcePath(filePath);
	}

	public async fetch(item: IAppStorageItem): Promise<Buffer> {
		if (!item.sourcePath) {
			throw new Error('Invalid source path');
		}

View on GitHub (pinned to f9d3ec372b)

Solutions

  1. Ensure the Apps storage path setting is set (e.g. `App_Source_Package_Storage_Path`) and non-empty before the orchestrator initializes storage.
  2. Call `storage.setPath(absolutePath)` in setup code before invoking any storage operation.
  3. Verify the directory exists and the process has read/write permissions to it.

Example fix

// before
const storage = new AppFileSystemSourceStorage();
await storage.store(item, zip); // throws: path not set

// after
const storage = new AppFileSystemSourceStorage();
storage.setPath('/var/rocket.chat/app-sources');
await storage.store(item, zip);
Defensive patterns

Strategy: validation

Validate before calling

function hasStoragePath(storage: AppFileSystemSourceStorage): boolean {
	// reflect on whether setPath was called; safest is to always set it in setup
	return Boolean(process.env.APP_SOURCE_STORAGE_PATH);
}

Type guard

null

Try / catch

if (!process.env.APP_SOURCE_STORAGE_PATH) {
	throw new Error('APP_SOURCE_STORAGE_PATH must be configured');
}
storage.setPath(process.env.APP_SOURCE_STORAGE_PATH);
try {
	await storage.store(item, zip);
} catch (e) {
	if (e instanceof Error && e.message.includes('Invalid path configured')) {
		// fix configuration then retry
	}
	throw e;
}

Prevention

When it happens

Trigger: Invoking `store()`, `update()`, or `remove()` on an `AppFileSystemSourceStorage` instance before `setPath(path)` has been called, leaving `this.path` undefined.

Common situations: Misconfigured Apps engine storage (the `App_Source_Package_Storage_Path` setting is empty); a test or custom orchestrator constructing the storage directly without wiring the path; migration where the storage path env var was dropped.

Related errors


AI-assisted analysis of RocketChat/Rocket.Chat@f9d3ec372b (2026-08-12). Data as JSON: /api/errors/25c23faa5fc53d24. Report an issue: GitHub.