RocketChat/Rocket.Chat · error · Error

Transfer to entity with id ${transferData.to} not found

Error message

Transfer to entity with id ${transferData.to} not found

What it means

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.

Source

Thrown at apps/meteor/app/apps/server/bridges/listeners.ts:447

					.executeListener(args.event, {
						room: (await this.orch.getConverters().get('rooms').convertRoom(agentData.room)) as IAppsLivechatRoom,
						agent: this.orch.getConverters().get('users').convertToApp(agentData.user),
					});

			case AppInterface.IPostLivechatRoomTransferred: {
				const [transferData] = args.payload;
				const converter = transferData.type === LivechatTransferEventType.AGENT ? 'users' : 'departments';

				const room = await this.orch.getConverters().get('rooms').convertById(transferData.room);
				const from = await this.orch.getConverters().get(converter).convertById(transferData.from);
				const to = await this.orch.getConverters().get(converter).convertById(transferData.to);

				if (!room) {
					throw new Error(`Room with id ${transferData.room} not found`);
				}

				if (!to) {
					throw new Error(`Transfer to entity with id ${transferData.to} not found`);
				}

				return this.orch
					.getManager()
					.getListenerManager()
					.executeListener(args.event, {
						room,
						from: from as NonNullable<typeof from>, // type definition in the apps-engine seems to be incorrect
						to,
						type: transferData.type,
					});
			}

			case AppInterface.IPostLivechatGuestSaved: {
				const [visitorId] = args.payload;
				const visitor = await this.orch.getConverters().get('visitors').convertById(visitorId);

				if (!visitor) {

View on GitHub (pinned to f9d3ec372b)

Solutions

  1. Confirm transferData.to exists in the correct collection (users for AGENT, departments for DEPARTMENT).
  2. Ensure transferData.type matches the id kind.
  3. Investigate deletion races and data integrity.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await appListenerBridge.handleEvent({ event: AppInterface.IPostLivechatRoomTransferred, payload: [transferData] });
} catch (e) {
  if (e instanceof Error && /Transfer to entity with id .* not found/.test(e.message)) {
    logger.warn({ msg: 'Transfer event skipped: target missing', toId: transferData.to, type: transferData.type });
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: 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).

Common situations: Destination agent/department removed between transfer and event dispatch; type/id mismatch in the payload; data-integrity issue.

Related errors


AI-assisted analysis of RocketChat/Rocket.Chat@f9d3ec372b (2026-08-12). Data as JSON: /api/errors/217264d0b2744db8. Report an issue: GitHub.