RocketChat/Rocket.Chat · warning · Meteor.Error
isAgentAvailableToTakeContactInquiryResult.error
Error message
isAgentAvailableToTakeContactInquiryResult.error
What it means
takeInquiry consults isAgentAvailableToTakeContactInquiry; on a false result it rethrows Meteor.Error(result.error) with a code produced by that check. In Community Edition the base implementation always returns { value: true }, so this only fires on Enterprise with the 'contact-id-verification' license module. The EE patch returns one of: 'error-invalid-contact' (contact record missing/disabled), 'error-unknown-contact' (contact flagged unknown while Livechat_Block_Unknown_Contacts is on), or 'error-unverified-contact' (channel unverified while Livechat_Block_Unverified_Contacts is on).
Source
Thrown at apps/meteor/server/lib/omnichannel/takeInquiry.ts:55
method: 'livechat:takeInquiry',
...(process.env.TEST_MODE && {
Livechat_enabled_when_agent_idle: settings.get<boolean>('Livechat_enabled_when_agent_idle'),
Livechat_accept_chats_with_no_agents: settings.get<boolean>('Livechat_accept_chats_with_no_agents'),
user: await Users.findOneById(userId),
}),
});
}
const room = await LivechatRooms.findOneById(inquiry.rid);
if (!room || !(await Omnichannel.isWithinMACLimit(room))) {
throw new Meteor.Error('error-mac-limit-reached');
}
const contactId = room.contactId ?? (await migrateVisitorIfMissingContact(room.v._id, room.source));
if (contactId) {
const isAgentAvailableToTakeContactInquiryResult = await isAgentAvailableToTakeContactInquiry(inquiry.v._id, room.source, contactId);
if (!isAgentAvailableToTakeContactInquiryResult.value) {
throw new Meteor.Error(isAgentAvailableToTakeContactInquiryResult.error);
}
}
const agent = {
agentId: user._id,
username: user.username,
};
await RoutingManager.takeInquiry(inquiry, agent, options ?? {}, room);
};
View on GitHub (pinned to b2c16d5842)
Solutions
- Read err.error from the caught Meteor.Error to know which of the three codes fired
- For error-invalid-contact: restore/enable the contact record in the Contacts manager or let the inquiry be closed
- For error-unknown-contact: mark the contact as known or disable Livechat_Block_Unknown_Contacts
- For error-unverified-contact: verify the contact's channel in the contact record or disable Livechat_Block_Unverified_Contacts
- Confirm the license actually includes contact-id-verification; without the module the patched check is inactive
Example fix
// before
await Meteor.callAsync('livechat:takeInquiry', inquiryId);
// after
try {
await Meteor.callAsync('livechat:takeInquiry', inquiryId);
} catch (err) {
if (['error-invalid-contact', 'error-unknown-contact', 'error-unverified-contact'].includes(err?.error)) {
// surface contact verification guidance to the agent instead of a generic failure
return notifyContactBlocked(err.error);
}
throw err;
} Defensive patterns
Strategy: try-catch
Validate before calling
// if you control the caller and license, pre-check the same conditions the EE patch enforces
const contact = await LivechatContacts.findOneEnabledById(contactId, { projection: { unknown: 1, channels: 1 } });
const blocked = !contact
|| (contact.unknown && settings.get('Livechat_Block_Unknown_Contacts'))
|| (!hasVerifiedChannel(contact.channels, visitorId, source) && settings.get('Livechat_Block_Unverified_Contacts'));
if (blocked) {
return warnAgent('contact is blocked by verification policy');
}
await Meteor.callAsync('livechat:takeInquiry', inquiryId); Type guard
type Availability = { error: string; value: false } | { value: true };
function isBlockedResult(v: Availability): v is { error: string; value: false } {
return v.value === false;
} Try / catch
try {
await Meteor.callAsync('livechat:takeInquiry', inquiryId);
} catch (err) {
const blocked = ['error-invalid-contact', 'error-unknown-contact', 'error-unverified-contact'];
if (err instanceof Meteor.Error && blocked.includes(err.error)) {
// guide the agent: verify the contact or adjust block-unknown/unverified settings
} else {
throw err;
}
} Prevention
- Know your license modules — without contact-id-verification this branch never fires
- Keep contact records enabled and channels verified when block settings are on
- Train agents that these codes mean policy-blocked contacts, not system failures
When it happens
Trigger: An EE workspace with the contact-id-verification module takes an inquiry where: the contact document was deleted/disabled, an unknown contact is blocked by Livechat_Block_Unknown_Contacts, or the visitor's channel isn't verified and Livechat_Block_Unverified_Contacts is enabled.
Common situations: Compliance deployments that block unknown/unverified contacts (WhatsApp/SMS verification flows), contacts merged or deleted in the contact manager while their inquiry was queued, or the verification settings enabled after inquiries were already created.
Related errors
- error-action-not-allowed
- error-contact-not-found
- error-visitor-not-found
- room-still-open
- improper-room-state
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/83f7951b5be15c70.
Report an issue: GitHub.