{"record":{"id":"5d95bb63a2866953","repo":"RocketChat/Rocket.Chat","slug":"invalid-app-user-cannot-transfer","errorCode":null,"errorMessage":"Invalid app user, cannot transfer","messagePattern":"Invalid app user, cannot transfer","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/app/apps/server/bridges/livechat.ts","lineNumber":269,"sourceCode":"\t\t\tshouldConsiderIdleAgent: settings.get<boolean>('Livechat_enabled_when_agent_idle'),\n\t\t\tshouldConsiderOfflineAgent: settings.get<boolean>('Livechat_accept_chats_with_no_agents'),\n\t\t});\n\n\t\treturn this.orch.getConverters()?.get('visitors').convertVisitor(livechatVisitor);\n\t}\n\n\tprotected async transferVisitor(visitor: IVisitor, transferData: ILivechatTransferData, appId: string): Promise<boolean> {\n\t\tthis.orch.debugLog(`The App ${appId} is transfering a livechat.`);\n\n\t\tif (!visitor) {\n\t\t\tthrow new Error('Invalid visitor, cannot transfer');\n\t\t}\n\n\t\tconst { targetAgent, targetDepartment: departmentId, currentRoom } = transferData;\n\n\t\tconst appUser = await Users.findOneByAppId(appId, {});\n\t\tif (!appUser) {\n\t\t\tthrow new Error('Invalid app user, cannot transfer');\n\t\t}\n\t\tconst { _id, username, name, type } = appUser;\n\t\tconst transferredBy = {\n\t\t\t_id,\n\t\t\tusername,\n\t\t\tname,\n\t\t\ttype,\n\t\t\tuserType: 'user',\n\t\t} as const;\n\n\t\tlet userId;\n\t\tlet transferredTo;\n\n\t\tif (targetAgent?.id) {\n\t\t\ttransferredTo = await Users.findOneAgentById(targetAgent.id, {\n\t\t\t\tprojection: { _id: 1, username: 1, name: 1 },\n\t\t\t});\n\t\t\tif (!transferredTo) {","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/2a7de457074cbb4d4373fbd9a4e5bea292c9c764/apps/meteor/app/apps/server/bridges/livechat.ts#L251-L287","documentation":"Error \"Invalid app user, cannot transfer\" thrown in RocketChat/Rocket.Chat.","triggerScenarios":"Thrown at apps/meteor/app/apps/server/bridges/livechat.ts:269 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the app has a registered app user (Users.findOneByAppId) before transferring a livechat.","Reinstall or re-enable the app so its app user is created, then retry the transfer."],"exampleFix":"Check the app user exists before transfer: if (!appUser) { throw new Error('Invalid app user, cannot transfer'); }","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2a7de457074cbb4d4373fbd9a4e5bea292c9c764","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}