RocketChat/Rocket.Chat · error · Error

Invalid app user, cannot transfer

Error message

Invalid app user, cannot transfer

What it means

Error "Invalid app user, cannot transfer" thrown in RocketChat/Rocket.Chat.

Solutions

  1. Ensure the app has a registered app user (Users.findOneByAppId) before transferring a livechat.
  2. Reinstall or re-enable the app so its app user is created, then retry the transfer.

Example fix

Check the app user exists before transfer: if (!appUser) { throw new Error('Invalid app user, cannot transfer'); }

When it happens

Trigger: Thrown at apps/meteor/app/apps/server/bridges/livechat.ts:269 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/5d95bb63a2866953. Report an issue: GitHub.

Appendix: source

Thrown at apps/meteor/app/apps/server/bridges/livechat.ts:269

			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;
		let transferredTo;

		if (targetAgent?.id) {
			transferredTo = await Users.findOneAgentById(targetAgent.id, {
				projection: { _id: 1, username: 1, name: 1 },
			});
			if (!transferredTo) {

View on GitHub (pinned to 2a7de45707)