RocketChat/Rocket.Chat · error

error-transferring-inquiry

error-transferring-inquiry

Error message

error-transferring-inquiry

What it means

The department-forward path throws error-transferring-inquiry when LivechatInquiry.findOneByRoomId finds no inquiry for the room. Same root cause as error-invalid-inquiry on the agent path (dequeued/closed/consumed inquiry), but a distinct error code so callers can tell which forward API failed.

Source

Thrown at apps/meteor/server/lib/omnichannel/Helper.ts:642

		return false;
	}
	logger.debug({
		msg: 'Attempting to forward room to department',
		roomId: room._id,
		departmentId: transferData.departmentId,
	});

	await callbacks.run('livechat.beforeForwardRoomToDepartment', { room, transferData });
	const { _id: rid, servedBy: oldServedBy, departmentId: oldDepartmentId } = room;
	let agent = null;

	const inquiry = await LivechatInquiry.findOneByRoomId(rid, {});
	if (!inquiry) {
		logger.debug({
			msg: 'Cannot forward room. No inquiries found',
			roomId: room._id,
		});
		throw new Error('error-transferring-inquiry');
	}

	const { departmentId } = transferData;
	if (!departmentId) {
		logger.debug({
			msg: 'Cannot forward room. No departmentId provided',
			roomId: room._id,
		});
		throw new Error('error-transferring-inquiry-no-department');
	}
	if (oldDepartmentId === departmentId) {
		throw new Error('error-forwarding-chat-same-department');
	}

	const { userId: agentId, clientAction } = transferData;
	if (agentId) {
		logger.debug({
			msg: 'Forwarding room to department and user',

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Re-check that the room is open and has an inquiry, then retry once
  2. Prevent duplicate submissions in the transfer UI
  3. If the room needs routing again, put it back in the queue instead of forwarding
Defensive patterns

Strategy: validation

Validate before calling

const inquiry = await LivechatInquiry.findOneByRoomId(room._id, { projection: { _id: 1 } });
if (!inquiry || !room.open) {
  // nothing to forward; re-queue or abort instead of calling the transfer
}

Try / catch

try {
  await forwardRoomToDepartment(room, transferData, guest);
} catch (err) {
  if (err instanceof Error && err.message === 'error-transferring-inquiry') {
    // inquiry gone: refresh and retry at most once if the room is still open
  } else throw err;
}

Prevention

When it happens

Trigger: livechat/room.forward with only departmentId on a room whose inquiry was already consumed by a previous transfer; room closed concurrently; duplicate department-forward submissions.

Common situations: Racing transfer requests from two supervisors; chat closed while the transfer dialog was open; retry of an already-completed transfer.

Related errors


AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18). Data as JSON: /api/errors/b354a1ad23f32e38. Report an issue: GitHub.