RocketChat/Rocket.Chat · error · Error

error-invalid-inquiry

Error message

error-invalid-inquiry

What it means

Thrown by resumeRoomOnHold when LivechatInquiry.findOneByRoomId returns no inquiry. A held omnichannel room must have a corresponding inquiry document to resume routing; the service logs 'No inquiry found for room' at error level and aborts.

Source

Thrown at apps/meteor/ee/server/local-services/omnichannel.internalService.ts:107

		if (!room.open) {
			throw new Error('This_conversation_is_already_closed');
		}

		if (!room.onHold) {
			throw new Error('error-room-not-on-hold');
		}

		const { _id: roomId, servedBy } = room;

		if (!servedBy) {
			this.logger.error({ msg: 'No serving agent found for room', roomId });
			throw new Error('error-room-not-served');
		}

		const inquiry = await LivechatInquiry.findOneByRoomId(roomId, {});
		if (!inquiry) {
			this.logger.error({ msg: 'No inquiry found for room', roomId });
			throw new Error('error-invalid-inquiry');
		}

		await this.attemptToAssignRoomToServingAgentElseQueueIt({
			room,
			inquiry,
			servingAgent: servedBy,
			clientAction,
		});

		const [roomResult, subsResult] = await Promise.all([
			LivechatRooms.unsetOnHoldByRoomId(roomId),
			Subscriptions.unsetOnHoldByRoomId(roomId),
			Message.saveSystemMessage<IOmnichannelSystemMessage>('omnichannel_on_hold_chat_resumed', roomId, '', resumeBy, { comment }),
		]);

		if (roomResult.modifiedCount) {
			void notifyOnRoomChangedById(roomId);
		}

View on GitHub (pinned to f9d3ec372b)

Solutions

  1. Confirm a LivechatInquiry exists for the roomId before offering Resume.
  2. If inquiries are missing for held rooms, run a backfill/reconciliation job that recreates them from the room document.
  3. Audit custom integrations that delete or move inquiry documents.

Example fix

// before
await omnichannelService.resumeRoomOnHold(room, comment, user);

// after
const inquiry = await LivechatInquiry.findOneByRoomId(room._id, {});
if (!inquiry) {
  throw new Error('Cannot resume: no inquiry record for this room');
}
await omnichannelService.resumeRoomOnHold(room, comment, user);
Defensive patterns

Strategy: validation

Validate before calling

const inquiry = await LivechatInquiry.findOneByRoomId(room._id, {});
if (!inquiry) throw new Error('Cannot resume: no inquiry record for this room');
await omnichannelService.resumeRoomOnHold(room, comment, user);

Type guard

function isInquiryLike(doc: unknown): doc is ILivechatInquiryRecord {
  return !!doc && typeof (doc as any)._id === 'string' && typeof (doc as any).rid === 'string';
}

Try / catch

try {
  await omnichannelService.resumeRoomOnHold(room, comment, user);
} catch (e) {
  if (e instanceof Error && e.message === 'error-invalid-inquiry') {
    notifyUser('This room cannot be resumed; the inquiry record is missing.');
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: Resume on a room whose LivechatInquiry record is missing or was deleted — typically a data inconsistency or a room whose inquiry was archived/removed while on hold.

Common situations: Inquiry cleanup/migration removed the record; the room was created by an import that did not backfill inquiries; a custom integration deleted inquiries.

Related errors


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