RocketChat/Rocket.Chat · error · Meteor.Error

no-agent-online

no-agent-online

Error message

Sorry, no online agents

What it means

Thrown by QueueManager.requestRoom during livechat room creation when a specific agent was selected for the chat (the `agent` argument) but beforeDelegateAgent() could not confirm that agent as available, so no default agent exists to serve the room. It is a Meteor.Error with code 'no-agent-online'. The whole check only runs while the workspace setting 'Livechat_accept_chats_with_no_agents' is disabled; when enabled, rooms are created even with no online agent.

Source

Thrown at apps/meteor/server/lib/omnichannel/QueueManager.ts:345

		 * 1. agent and no department
		 * 2. no agent and no department
		 * 3. no agent and department
		 * 4. agent and department informed
		 *
		 * in case 1, we check if the agent is online
		 * in case 2, we check if there is at least one online agent in the whole service
		 * in case 3, we check if there is at least one online agent in the department
		 *
		 * the case 4 is weird, but we are not throwing an error, just because the application works in some mysterious way
		 * we don't have explicitly defined what to do in this case so we just kept the old behavior
		 * it seems that agent has priority over department
		 * but some cases department is handled before agent
		 *
		 */

		if (!settings.get('Livechat_accept_chats_with_no_agents')) {
			if (agent && !defaultAgent) {
				throw new Meteor.Error('no-agent-online', 'Sorry, no online agents');
			}

			if (!defaultAgent && guest.department && !department) {
				throw new Meteor.Error('no-agent-online', 'Sorry, no online agents');
			}

			if (!agent && !guest.department && !(await checkOnlineAgents())) {
				throw new Meteor.Error('no-agent-online', 'Sorry, no online agents');
			}
		}

		const insertionRoom = await prepareLivechatRoom(rid, { ...guest, ...(department && { department }) }, roomInfo, {
			...extraData,
			...(Boolean(customFields) && { customFields }),
		});

		try {
			await Apps.self?.triggerEvent(AppEvents.IPreLivechatRoomCreatePrevent, insertionRoom);

View on GitHub (pinned to 2a7de45707)

Solutions

  1. Set the requested agent's status to online (available) or re-add the livechat-agent role, then retry the room request
  2. Enable the workspace setting Livechat_accept_chats_with_no_agents so rooms are created and queued without an online agent
  3. Route the visitor to a department with multiple online agents instead of pinning one agent
  4. Catch the Meteor.Error with error 'no-agent-online' and present an offline form / queue message to the visitor
Defensive patterns

Strategy: validation

Validate before calling

import { Users } from '@rocket.chat/models';
import { settings } from '../../../settings/server';

// Before requesting a room pinned to a specific agent:
if (!settings.get('Livechat_accept_chats_with_no_agents')) {
  const agentUser = await Users.findOne(agent.agentId, { projection: { status: 1, statusLivechat: 1, roles: 1 } });
  const online = !!agentUser && agentUser.status === 'online' && !!agentUser.roles?.includes('livechat-agent');
  if (!online) {
    // pick another agent, route to a department, or show the offline form
  }
}

Try / catch

try {
  const { room } = await QueueManager.requestRoom({ guest, roomInfo, agent });
} catch (err: any) {
  if (err?.error === 'no-agent-online') {
    // no online agent for this request: offer the offline form or retry later
    return showOfflineForm();
  }
  throw err;
}

Prevention

When it happens

Trigger: Calling QueueManager.requestRoom with an `agent` (SelectedAgent) whose user is offline/away or no longer holds the livechat-agent role, so beforeDelegateAgent returns null, while Livechat_accept_chats_with_no_agents is false. Typical entry points: returning-visitor flows that pin the previous agent, and livechat room-creation APIs/methods that accept an agent parameter.

Common situations: After-hours traffic while the single assigned agent is logged off; the agent was removed from the livechat-agent role but is still stored as the visitor's assigned agent; environment drift where the accept-chats-with-no-agents setting is off in production but on in staging.

Related errors


AI-assisted analysis of RocketChat/Rocket.Chat@2a7de45707 (2026-08-18). Data as JSON: /api/errors/7dd2539100b08e1b. Report an issue: GitHub.