RocketChat/Rocket.Chat · error · Error
Provided agent is not online
Error message
Provided agent is not online
What it means
Plain Error thrown by validateMaxChats on 'livechat.checkAgentBeforeTakeInquiry' when checkOnlineAgents(undefined, agent) reports the target agent as not online. An agent must be online (available status) at the moment of taking an inquiry from the waiting queue.
Solutions
- Set the agent's Livechat status to Online (statusLivechat 'available' and a synchronous status) and retry
- Verify the user actually has the livechat-agent role and appears in the online agents registry
- If automating takes, poll for agent online state before issuing the take action
Example fix
// before: taking the inquiry blindly
await callbacks.run('livechat.checkAgentBeforeTakeInquiry', inquiry, agent);
// after: apply the same online gate first
if (!(await checkOnlineAgents(undefined, agent))) {
throw new Error('Agent must be online to take an inquiry');
}
await callbacks.run('livechat.checkAgentBeforeTakeInquiry', inquiry, agent); Defensive patterns
Strategy: validation
Validate before calling
const agentIsOnline = async (agent: { agentId: string; status?: string }): Promise<boolean> =>
Boolean(await checkOnlineAgents(undefined, agent)); Try / catch
try {
await takeInquiry(inquiry, agent);
} catch (err: any) {
if (err?.message === 'Provided agent is not online') {
// prompt agent to go online; retry only after statusLivechat is available
}
throw err;
} Prevention
- Gate the take action in the UI on the agent's livechat online status
- Re-check status server-side right before automated takes
- Train agents that queue takes require Online (not away/busy) status
When it happens
Trigger: Taking a queued inquiry while the agent's status is away/busy/offline or the agent lacks livechat-agent availability; races where the agent went offline between the UI action and the server check.
Common situations: Agents forgetting to switch back to Online after a break; status sync delays after reconnects; automation trying to auto-assign to agents whose livechat status is not online.
Related errors
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/e3a807c741b0468c.
Report an issue: GitHub.
Appendix: source
Thrown at apps/meteor/ee/server/hooks/omnichannel/checkAgentBeforeTakeInquiry.ts:37
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;
}
const { department: departmentId } = inquiry;
const user = await Users.getAgentAndAmountOngoingChats(agentId, departmentId);
if (!user) {
cbLogger.debug({ msg: 'No valid agent found', agentId });
throw new Error('No valid agent found');
}View on GitHub (pinned to b2c16d5842)