RocketChat/Rocket.Chat · error · Error
Provided agent is not online
Error message
Provided agent is not online
What it means
Thrown by the `livechat.checkAgentBeforeTakeInquiry` callback when `checkOnlineAgents(undefined, agent)` returns false, meaning the provided agent is not currently considered online/available. It is a plain `Error`; logged at debug level first. It prevents taking an inquiry by an agent who cannot accept it.
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 f9d3ec372b)
Solutions
- Have the agent set their livechat status to available/online before taking the inquiry.
- Verify `checkOnlineAgents` reflects current status (no stale cache).
- Reassign the inquiry to an online agent.
Defensive patterns
Strategy: validation
Validate before calling
import { checkOnlineAgents } from '../../../../server/lib/livechat';
async function agentIsOnline(agent: ILivechatAgent): Promise<boolean> {
return checkOnlineAgents(undefined, agent);
} Type guard
function isAgentNotOnlineError(e: unknown): boolean {
return e instanceof Error && e.message === 'Provided agent is not online';
} Try / catch
try {
await callbacks.run('livechat.checkAgentBeforeTakeInquiry', inquiry, agent);
} catch (e) {
if (e instanceof Error && e.message === 'Provided agent is not online') {
// agent must set status to available first
}
throw e;
} Prevention
- Ensure the agent's livechat status is online/available before taking inquiries.
- Refresh agent status to avoid stale availability data.
- Reassign to an online agent when the target is away.
When it happens
Trigger: Invoking the take-inquiry callback for an agent whose livechat status is offline/away, so `checkOnlineAgents` returns false.
Common situations: Agent set themselves away/offline then attempted to take an inquiry; agent's livechat availability not yet synced; agent removed from service while action in flight.
Related errors
- No valid agent found
- error-forwarding-department-target-not-allowed
- error-max-number-simultaneous-chats-reached
- error-invalid-sla
- error-invalid-priority
AI-assisted analysis of RocketChat/Rocket.Chat@f9d3ec372b (2026-08-12).
Data as JSON: /api/errors/e3a807c741b0468c.
Report an issue: GitHub.