{"record":{"id":"217264d0b2744db8","repo":"RocketChat/Rocket.Chat","slug":"transfer-to-entity-with-id-transferdata-to-not","errorCode":null,"errorMessage":"Transfer to entity with id ${transferData.to} not found","messagePattern":"Transfer to entity with id (.+?) not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/app/apps/server/bridges/listeners.ts","lineNumber":447,"sourceCode":"\t\t\t\t\t.executeListener(args.event, {\n\t\t\t\t\t\troom: (await this.orch.getConverters().get('rooms').convertRoom(agentData.room)) as IAppsLivechatRoom,\n\t\t\t\t\t\tagent: this.orch.getConverters().get('users').convertToApp(agentData.user),\n\t\t\t\t\t});\n\n\t\t\tcase AppInterface.IPostLivechatRoomTransferred: {\n\t\t\t\tconst [transferData] = args.payload;\n\t\t\t\tconst converter = transferData.type === LivechatTransferEventType.AGENT ? 'users' : 'departments';\n\n\t\t\t\tconst room = await this.orch.getConverters().get('rooms').convertById(transferData.room);\n\t\t\t\tconst from = await this.orch.getConverters().get(converter).convertById(transferData.from);\n\t\t\t\tconst to = await this.orch.getConverters().get(converter).convertById(transferData.to);\n\n\t\t\t\tif (!room) {\n\t\t\t\t\tthrow new Error(`Room with id ${transferData.room} not found`);\n\t\t\t\t}\n\n\t\t\t\tif (!to) {\n\t\t\t\t\tthrow new Error(`Transfer to entity with id ${transferData.to} not found`);\n\t\t\t\t}\n\n\t\t\t\treturn this.orch\n\t\t\t\t\t.getManager()\n\t\t\t\t\t.getListenerManager()\n\t\t\t\t\t.executeListener(args.event, {\n\t\t\t\t\t\troom,\n\t\t\t\t\t\tfrom: from as NonNullable<typeof from>, // type definition in the apps-engine seems to be incorrect\n\t\t\t\t\t\tto,\n\t\t\t\t\t\ttype: transferData.type,\n\t\t\t\t\t});\n\t\t\t}\n\n\t\t\tcase AppInterface.IPostLivechatGuestSaved: {\n\t\t\t\tconst [visitorId] = args.payload;\n\t\t\t\tconst visitor = await this.orch.getConverters().get('visitors').convertById(visitorId);\n\n\t\t\t\tif (!visitor) {","sourceCodeStart":429,"sourceCodeEnd":465,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/app/apps/server/bridges/listeners.ts#L429-L465","documentation":"FileUpload.get resolves the serving handler from the upload record's store field (e.g. 'FileSystem:Uploads', 'S3:Avatars', 'Webdav:Uploads'). If no handler with that name is registered on this server (getStoreByName logs 'Upload handler does not exists' and returns undefined) or the handler has no get, it responds 404 — the file record exists, but this deployment cannot serve that store. Classic after storage-type changes without migrating files, or when a store's registering module is not loaded.","triggerScenarios":"file.store names a store this server never registered: storage type switched (e.g. FileSystem to Amazon S3) and the old store handler is unavailable; a DB restored from a deployment with different storage settings; store name typos in migrated data; a custom store module removed between versions.","commonSituations":"FileUpload storage migrations leaving old records unservable; environment drift between staging and production; upgrades that dropped store registrations; manual Mongo edits to upload documents.","solutions":["Keep the previous store handler available so old files remain servable (Rocket.Chat registers store classes regardless of the active type) or migrate file bytes to the active store","Verify the module registering the missing store (config/FileSystem.ts, config/AmazonS3.ts, config/Webdav.ts) is actually loaded on this server","Compare the file's store value against the registered handlers (a SystemLogger 'Upload handler does not exists' entry names the exact handlerName) and fix stale values on migration","As a last resort, re-upload affected files or move them between stores programmatically"],"exampleFix":"// before\nFileUpload.get(file, req, res, next); // 404 when store handler absent\n// after: guard and report the migration gap\nconst store = FileUpload.getStoreByName(file.store);\nif (!store?.get) {\n\tSystemLogger.error({ msg: 'no handler for store', store: file.store, fileId: file._id });\n\treturn; // schedule migration instead of a bare 404\n}","handlingStrategy":"type-guard","validationCode":"const handler = FileUpload.handlers[file.store as string];\nif (!handler?.get) { /* this server cannot serve store ${file.store}: migrate or fix before calling FileUpload.get */ }","typeGuard":"const isServableStore = (storeName?: string): boolean => { try { return typeof FileUpload.getStoreByName(storeName)?.get === 'function'; } catch { return false; } };","tryCatchPattern":null,"preventionTips":["Before storage migrations, inventory distinct store values in the Uploads/Avatars collections and keep old handlers registered until files are moved","Alert on SystemLogger 'Upload handler does not exists' entries — they name the exact missing handlerName","Validate file.store values after restoring databases from other deployments","Test downloads of pre-migration files after every storage-type change"],"tags":["file-upload","http-404","storage-migration","store-handler"],"backgroundTag":"store-handler-not-registered","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}