RocketChat/Rocket.Chat · error

error-invalid-inquiry

error-invalid-inquiry

Error message

error-invalid-inquiry

What it means

Forwarding a livechat room to an agent requires an open inquiry for that room (LivechatInquiry.findOneByRoomId); if none exists the forward aborts with error-invalid-inquiry. Inquiries exist only while a chat is queued or being served - closed rooms and rooms whose inquiry was already consumed by another transfer have none.

Source

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

		settings.get<boolean>('Livechat_accept_chats_with_no_agents'),
		{},
	);
	if (!user) {
		logger.debug({
			msg: 'Agent is offline. Cannot forward',
			agentId,
		});
		throw new Error('error-user-is-offline');
	}

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

	if (oldServedBy && agentId === oldServedBy._id) {
		throw new Error('error-selected-agent-room-agent-are-same');
	}

	const { username } = user;
	const agent = { agentId, username };
	// Remove department from inquiry to make sure the routing algorithm treat this as forwarding to agent and not as forwarding to department
	delete inquiry.department;
	// There are some Enterprise features that may interrupt the forwarding process
	// Due to that we need to check whether the agent has been changed or not
	logger.debug({
		msg: 'Forwarding inquiry to agent',
		inquiryId: inquiry._id,
		agentId: agent.agentId,
	});
	const roomTaken = await RoutingManager.takeInquiry(

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Refresh the room/inquiry state and retry once if the room is still open
  2. Guard the transfer UI against duplicate submissions (disable the button while pending)
  3. If the chat legitimately has no inquiry, place it back in the queue instead of forwarding
Defensive patterns

Strategy: validation

Validate before calling

const inquiry = await LivechatInquiry.findOneByRoomId(rid, { projection: { _id: 1 } });
if (!inquiry) {
  // no inquiry: re-queue the room instead of forwarding
  throw new Error('error-invalid-inquiry');
}

Try / catch

try {
  await forwardRoomToAgent(room, transferData, guest);
} catch (err) {
  if (err instanceof Error && err.message === 'error-invalid-inquiry') {
    // refresh room state; retry only if still open and un-transferred
  } else throw err;
}

Prevention

When it happens

Trigger: Forwarding a room whose inquiry was already dequeued by a concurrent transfer; forward attempted on a chat the customer closed; stale room list in the agent UI.

Common situations: Double-click or duplicate forward requests racing each other; chat closed while the transfer dialog was open; automation retrying an already-completed transfer.

Related errors


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