RocketChat/Rocket.Chat · error · Error
Invalid visitor, cannot transfer
Error message
Invalid visitor, cannot transfer
What it means
Error "Invalid visitor, cannot transfer" thrown in RocketChat/Rocket.Chat.
Solutions
- Pass a valid visitor object to transferVisitor; do not call it with a null or undefined visitor.
- Fetch the visitor first and confirm it exists before initiating the transfer.
Example fix
Check the visitor exists before transfer: if (!visitor) { throw new Error('Invalid visitor, cannot transfer'); } When it happens
Trigger: Thrown at apps/meteor/app/apps/server/bridges/livechat.ts:262 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of RocketChat/Rocket.Chat@2a7de45707 (2026-08-18).
Data as JSON: /api/errors/c9b80c39ba5dd620.
Report an issue: GitHub.
Appendix: source
Thrown at apps/meteor/app/apps/server/bridges/livechat.ts:262
id: visitor.id,
...(visitor.phone?.length && { phone: { number: visitor.phone[0].phoneNumber } }),
...(visitor.visitorEmails?.length && { email: visitor.visitorEmails[0].address }),
...(externalIds?.length && { externalIds }),
};
const livechatVisitor = await registerGuest(registerData, {
shouldConsiderIdleAgent: settings.get<boolean>('Livechat_enabled_when_agent_idle'),
shouldConsiderOfflineAgent: settings.get<boolean>('Livechat_accept_chats_with_no_agents'),
});
return this.orch.getConverters()?.get('visitors').convertVisitor(livechatVisitor);
}
protected async transferVisitor(visitor: IVisitor, transferData: ILivechatTransferData, appId: string): Promise<boolean> {
this.orch.debugLog(`The App ${appId} is transfering a livechat.`);
if (!visitor) {
throw new Error('Invalid visitor, cannot transfer');
}
const { targetAgent, targetDepartment: departmentId, currentRoom } = transferData;
const appUser = await Users.findOneByAppId(appId, {});
if (!appUser) {
throw new Error('Invalid app user, cannot transfer');
}
const { _id, username, name, type } = appUser;
const transferredBy = {
_id,
username,
name,
type,
userType: 'user',
} as const;
let userId;View on GitHub (pinned to 2a7de45707)