RocketChat/Rocket.Chat · error · Error
No inquiry or agent provided
Error message
No inquiry or agent provided
What it means
Thrown by the `livechat.checkAgentBeforeTakeInquiry` callback (`validateMaxChats`) when `inquiry._id` or `agent.agentId` is missing. It is a plain `Error`; the callback logs at debug level before throwing. It guards the take-inquiry flow against incomplete input.
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 f9d3ec372b)
Solutions
- Ensure both `inquiry._id` and `agent.agentId` are populated before invoking the take-inquiry flow.
- Validate inputs at the calling boundary and return early with a clear message if missing.
- Re-fetch the inquiry/agent if they may have been removed.
Example fix
// before
const result = await callbacks.run('livechat.checkAgentBeforeTakeInquiry', inquiry, agent);
// after
if (!inquiry?._id || !agent?.agentId) {
throw new Error('Cannot take inquiry: inquiry id and agent id are required');
}
const result = await callbacks.run('livechat.checkAgentBeforeTakeInquiry', inquiry, agent); Defensive patterns
Strategy: validation
Validate before calling
function hasInquiryAndAgent(inquiry: { _id?: string } | undefined, agent: { agentId?: string } | undefined): boolean {
return Boolean(inquiry?._id && agent?.agentId);
} Type guard
function isNoInquiryOrAgentError(e: unknown): boolean {
return e instanceof Error && e.message === 'No inquiry or agent provided';
} Try / catch
try {
await callbacks.run('livechat.checkAgentBeforeTakeInquiry', inquiry, agent);
} catch (e) {
if (e instanceof Error && e.message === 'No inquiry or agent provided') {
// populate inquiry._id and agent.agentId
}
throw e;
} Prevention
- Populate `inquiry._id` and `agent.agentId` before the take-inquiry flow.
- Validate inputs at the calling boundary.
- Re-fetch inquiry/agent if they may have been removed.
When it happens
Trigger: The take-inquiry callback is invoked with an `inquiry` lacking `_id` and/or an `agent` lacking `agentId` (undefined/null).
Common situations: Caller forgot to populate the inquiry or agent object; upstream lookup returned null and was passed through unchecked; race where inquiry was deleted before take action.
Related errors
- error-forwarding-department-target-not-allowed
- error-invalid-sla
- error-invalid-priority
- error-invalid-sla
- Provided agent is not online
AI-assisted analysis of RocketChat/Rocket.Chat@f9d3ec372b (2026-08-12).
Data as JSON: /api/errors/0322084982d8d79d.
Report an issue: GitHub.