RocketChat/Rocket.Chat · error · Error
No inquiry or agent provided
Error message
No inquiry or agent provided
What it means
Plain Error thrown by the validateMaxChats handler on 'livechat.checkAgentBeforeTakeInquiry' when the callback is invoked without a usable inquiry (missing inquiry._id) or agent (missing agent.agentId). It is a contract violation of the internal callback signature, not a user-capacity condition.
Solutions
- Pass a fully populated inquiry (with _id) and agent (with agentId) when running the callback
- Re-fetch the inquiry by rid right before taking it, so a just-dequeued inquiry surfaces as 'not found' rather than an empty payload
- If writing custom code, call the higher-level take-inquiry service instead of the raw callback
Example fix
// before: invoking the callback with possibly-empty payloads
await callbacks.run('livechat.checkAgentBeforeTakeInquiry', inquiry, agent);
// after: guard the contract the hook enforces
if (!inquiry?._id || !agent?.agentId) {
throw new Error('inquiry and agent are required to take an inquiry');
}
await callbacks.run('livechat.checkAgentBeforeTakeInquiry', inquiry, agent); Defensive patterns
Strategy: validation
Validate before calling
const canRunTakeCheck = (inquiry?: { _id?: string }, agent?: { agentId?: string }): boolean =>
Boolean(inquiry?._id && agent?.agentId); Type guard
const hasTakeInquiryPayload = (
payload: unknown,
): payload is { inquiry: { _id: string }; agent: { agentId: string } } => {
if (typeof payload !== 'object' || payload === null) return false;
const p = payload as any;
return typeof p?.inquiry?._id === 'string' && typeof p?.agent?.agentId === 'string';
}; Try / catch
try {
await callbacks.run('livechat.checkAgentBeforeTakeInquiry', inquiry, agent);
} catch (err: any) {
if (err?.message === 'No inquiry or agent provided') {
// refill inquiry/agent from fresh queries; this is a payload bug, not a retry case
}
throw err;
} Prevention
- Never invoke the take-inquiry callback without a freshly loaded inquiry and agent
- Type the callback payload at call sites so missing fields fail at compile time
- Distinguish payload errors from capacity errors in take-inquiry error handling
When it happens
Trigger: Server code or an app calling callbacks.run('livechat.checkAgentBeforeTakeInquiry', ...) with undefined/null inquiry or agent objects, or objects shaped without _id/agentId; take-inquiry flows where the inquiry was already dequeued before the check ran.
Common situations: Custom enterprise logic invoking the take-inquiry callback directly; race between waiting-queue processing and the take action removing the inquiry; refactors that changed the callback payload shape.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/0322084982d8d79d.
Report an issue: GitHub.
Appendix: source
Thrown at apps/meteor/ee/server/hooks/omnichannel/checkAgentBeforeTakeInquiry.ts:31
}: {
agent: {
agentId: string;
};
inquiry: {
_id: string;
department: string;
};
options: {
forwardingToDepartment?: {
oldDepartmentId: string;
transferData: any;
};
clientAction?: boolean;
};
}) => {
if (!inquiry?._id || !agent?.agentId) {
cbLogger.debug('No inquiry or agent provided');
throw new Error('No inquiry or agent provided');
}
const { agentId } = agent;
if (!(await checkOnlineAgents(undefined, agent))) {
cbLogger.debug('Provided agent is not online');
throw new Error('Provided agent is not online');
}
if (!settings.get('Livechat_waiting_queue')) {
cbLogger.info({ msg: 'Chat can be taken by Agent: waiting queue is disabled', agentId });
return agent;
}
if (await allowAgentSkipQueue(agent)) {
cbLogger.info({ msg: 'Chat can be taken by Agent: agent can skip queue', agentId });
return agent;
}
View on GitHub (pinned to b2c16d5842)