RocketChat/Rocket.Chat · error · Error
error-invalid-inquiry
error-invalid-inquiry
Error message
error-invalid-inquiry
What it means
After the verify+merge transaction commits, runVerifyContactChannel looks up the Livechat inquiry by roomId to re-queue/verify it; if none exists it throws error-invalid-inquiry. The code comment states this means 'something is really wrong with the queue' — the contact merge already committed (no rollback happens) and only the queue step failed.
Solutions
- Check the livechat_inquiry collection for the room (db.livechat_inquiry.findOne({ rid: roomId })) to confirm the record is missing.
- Determine whether an agent took the room concurrently — the room may need manual re-queueing via omnichannel queue APIs.
- If inquiries are systematically missing, audit rooms-vs-inquiries integrity before re-triggering verification.
- Note the merge itself succeeded — only re-create/re-queue the inquiry rather than re-running the whole flow.
Defensive patterns
Strategy: try-catch
Validate before calling
const inquiry = await LivechatInquiry.findOneByRoomId(roomId);
if (!inquiry) {
// queue record missing: fix/re-create the inquiry before triggering verification
} Try / catch
try {
await runVerifyContactChannel(null, params);
} catch (e) {
if (e instanceof Error && e.message === 'error-invalid-inquiry') {
// merge already committed: re-create/re-queue the inquiry manually and alert ops
}
throw e;
} Prevention
- Monitor consistency between livechat_rooms and livechat_inquiry collections
- Avoid triggering verification at the same moment an agent takes the room from the queue
- Remember this error means the destructive part succeeded — do not blindly re-run the flow
When it happens
Trigger: An omnichannel room whose livechat_inquiry record is missing while verification runs: inquiry deleted by queue cleanup, concurrently taken/removed by an agent, or data inconsistency from manual deletion or partial restore.
Common situations: Race between an agent taking the room off the queue and the visitor verifying their channel; manual deletion of inquiry documents; restores with missing inquiry collections.
Related errors
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/dd153fc05efab0a8.
Report an issue: GitHub.
Appendix: source
Thrown at apps/meteor/ee/server/patches/verifyContactChannel.ts:88
const room = await LivechatRooms.findOneById(roomId);
if (!room) {
throw new Error('error-invalid-room');
}
const result = await _verifyContactChannel(params, room);
logger.debug({ msg: 'Finding inquiry', roomId });
// Note: we are not using the session here since allowing the transactional flow to be used inside the
// saveQueueInquiry function would require a lot of changes across the codebase, so if we fail here we
// will not be able to rollback the transaction. That is not a big deal since the contact will be properly
// merged and the inquiry will be saved in the queue (will need to be taken manually by an agent though).
const inquiry = await LivechatInquiry.findOneByRoomId(roomId);
if (!inquiry) {
// Note: if this happens, something is really wrong with the queue, so we should throw an error to avoid
// carrying on a weird state.
throw new Error('error-invalid-inquiry');
}
if (inquiry.status === LivechatInquiryStatus.VERIFYING) {
logger.debug({ msg: 'Verifying inquiry', roomId });
await QueueManager.verifyInquiry(inquiry, room);
}
logger.debug({
msg: 'Contact channel has been verified and merged successfully',
contactId,
visitorId,
roomId,
});
return result;
};
verifyContactChannel.patch(runVerifyContactChannel, () => License.hasModule('contact-id-verification'));View on GitHub (pinned to b2c16d5842)