{"record":{"id":"25c23faa5fc53d24","repo":"RocketChat/Rocket.Chat","slug":"invalid-path-configured-for-file-system-app-storag","errorCode":null,"errorMessage":"Invalid path configured for file system App storage","messagePattern":"Invalid path configured for file system App storage","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/ee/server/apps/storage/AppFileSystemSourceStorage.ts","lineNumber":18,"sourceCode":"import { promises as fs } from 'node:fs';\nimport { join, normalize } from 'node:path';\n\nimport { AppSourceStorage } from '@rocket.chat/apps/dist/server/storage/AppSourceStorage';\nimport type { IAppStorageItem } from '@rocket.chat/apps/dist/server/storage/IAppStorageItem';\n\nexport class AppFileSystemSourceStorage extends AppSourceStorage {\n\tprivate pathPrefix = 'fs:/';\n\n\tprivate path: string;\n\n\tpublic setPath(path: string): void {\n\t\tthis.path = path;\n\t}\n\n\tpublic checkPath(): void {\n\t\tif (!this.path) {\n\t\t\tthrow new Error('Invalid path configured for file system App storage');\n\t\t}\n\t}\n\n\tpublic async store(item: IAppStorageItem, zip: Buffer): Promise<string> {\n\t\tthis.checkPath();\n\n\t\tconst filePath = this.itemToFilename(item);\n\n\t\tawait fs.writeFile(filePath, zip);\n\n\t\treturn this.filenameToSourcePath(filePath);\n\t}\n\n\tpublic async fetch(item: IAppStorageItem): Promise<Buffer> {\n\t\tif (!item.sourcePath) {\n\t\t\tthrow new Error('Invalid source path');\n\t\t}\n","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/ee/server/apps/storage/AppFileSystemSourceStorage.ts#L1-L36","documentation":"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.","triggerScenarios":"Invoking `store()`, `update()`, or `remove()` on an `AppFileSystemSourceStorage` instance before `setPath(path)` has been called, leaving `this.path` undefined.","commonSituations":"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.","solutions":["Ensure the Apps storage path setting is set (e.g. `App_Source_Package_Storage_Path`) and non-empty before the orchestrator initializes storage.","Call `storage.setPath(absolutePath)` in setup code before invoking any storage operation.","Verify the directory exists and the process has read/write permissions to it."],"exampleFix":"// before\nconst storage = new AppFileSystemSourceStorage();\nawait storage.store(item, zip); // throws: path not set\n\n// after\nconst storage = new AppFileSystemSourceStorage();\nstorage.setPath('/var/rocket.chat/app-sources');\nawait storage.store(item, zip);","handlingStrategy":"validation","validationCode":"function hasStoragePath(storage: AppFileSystemSourceStorage): boolean {\n\t// reflect on whether setPath was called; safest is to always set it in setup\n\treturn Boolean(process.env.APP_SOURCE_STORAGE_PATH);\n}","typeGuard":"null","tryCatchPattern":"if (!process.env.APP_SOURCE_STORAGE_PATH) {\n\tthrow new Error('APP_SOURCE_STORAGE_PATH must be configured');\n}\nstorage.setPath(process.env.APP_SOURCE_STORAGE_PATH);\ntry {\n\tawait storage.store(item, zip);\n} catch (e) {\n\tif (e instanceof Error && e.message.includes('Invalid path configured')) {\n\t\t// fix configuration then retry\n\t}\n\tthrow e;\n}","preventionTips":["Always call `setPath()` during storage initialization, before any operation.","Validate the configured path exists and is writable at startup.","Fail fast at boot if the Apps storage path setting is empty."],"tags":["apps-engine","storage","configuration","ee"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}