{"record":{"id":"43160915aa2454ab","repo":"RocketChat/Rocket.Chat","slug":"invalid-source-path","errorCode":null,"errorMessage":"Invalid source path","messagePattern":"Invalid source path","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/ee/server/apps/storage/AppFileSystemSourceStorage.ts","lineNumber":34,"sourceCode":"\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\n\t\treturn fs.readFile(this.sourcePathToFilename(item.sourcePath));\n\t}\n\n\tpublic async update(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 remove(item: IAppStorageItem): Promise<void> {\n\t\tif (!item.sourcePath) {\n\t\t\treturn;","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/ee/server/apps/storage/AppFileSystemSourceStorage.ts#L16-L52","documentation":"Thrown by `AppFileSystemSourceStorage.fetch()` when the `IAppStorageItem` has no `sourcePath`. The fetch operation translates a stored `sourcePath` (prefixed `fs:/...`) back to a filesystem filename; without a source path there is nothing to read. It indicates the storage item is incomplete or was never persisted via `store()`.","triggerScenarios":"Calling `fetch(item)` where `item.sourcePath` is undefined/null/empty — e.g. an app metadata record that was inserted without going through the source storage, or whose source bundle was never written.","commonSituations":"Reading an app record that predates the source-storage layer; a corrupted/partial install where metadata exists but the bundle reference is missing; test fixtures missing the `sourcePath` field.","solutions":["Verify the storage item was created via `store()`/`update()` which assign a `sourcePath`.","If the bundle is genuinely missing, re-install or re-upload the app so a source path is recorded.","Guard callers with a `item.sourcePath` check before calling `fetch()`."],"exampleFix":"// before\nconst buf = await storage.fetch(item); // throws if item.sourcePath missing\n\n// after\nif (!item.sourcePath) {\n\tthrow new Error('Cannot fetch app bundle: item has no sourcePath');\n}\nconst buf = await storage.fetch(item);","handlingStrategy":"validation","validationCode":"function hasSourcePath(item: IAppStorageItem): boolean {\n\treturn Boolean(item?.sourcePath);\n}","typeGuard":"import type { IAppStorageItem } from '@rocket.chat/apps-engine/server/storage';\n\nfunction hasValidSourcePath(item: unknown): item is IAppStorageItem & { sourcePath: string } {\n\treturn typeof (item as IAppStorageItem)?.sourcePath === 'string' && (item as IAppStorageItem).sourcePath.length > 0;\n}","tryCatchPattern":"if (!hasValidSourcePath(item)) {\n\tthrow new Error('Cannot fetch: item has no sourcePath');\n}\nconst buf = await storage.fetch(item);","preventionTips":["Always persist app bundles via `store()` so `sourcePath` is set.","Check `item.sourcePath` before calling `fetch()`.","Treat missing sourcePath as a data-integrity issue and re-install the app."],"tags":["apps-engine","storage","validation","ee"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}