{"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/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/app/apps/server/bridges/listeners.ts#L429-L465","documentation":"Same IPostLivechatRoomTransferred handler, after the room check (listeners.ts:446-448). The destination entity (`to`) is resolved via the 'users' converter for LivechatTransferEventType.AGENT or the 'departments' converter otherwise (listeners.ts:436). If it resolves to undefined the bridge throws — the transfer target agent or department could not be found.","triggerScenarios":"transferData.to references an agent user or department that was deleted, never existed, or could not be read; or transferData.type mismatches the id kind (an agent id passed with DEPARTMENT type, or vice versa).","commonSituations":"Destination agent/department removed between transfer and event dispatch; type/id mismatch in the payload; data-integrity issue.","solutions":["Confirm transferData.to exists in the correct collection (users for AGENT, departments for DEPARTMENT).","Ensure transferData.type matches the id kind.","Investigate deletion races and data integrity."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await appListenerBridge.handleEvent({ event: AppInterface.IPostLivechatRoomTransferred, payload: [transferData] });\n} catch (e) {\n  if (e instanceof Error && /Transfer to entity with id .* not found/.test(e.message)) {\n    logger.warn({ msg: 'Transfer event skipped: target missing', toId: transferData.to, type: transferData.type });\n    return;\n  }\n  throw e;\n}","preventionTips":["Verify the destination agent/department exists before initiating a transfer.","Keep transferData.type consistent with the destination id kind (AGENT->user, DEPARTMENT->department).","Handle deletion races gracefully when target entities may be removed mid-flow."],"tags":["apps-engine","livechat","listeners","data-integrity"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}