RocketChat/Rocket.Chat · error · Meteor.Error

error-agent-status-service-offline

error-agent-status-service-offline

Error message

error-agent-status-service-offline

What it means

Before letting a user take an inquiry, takeInquiry re-validates the taker via Users.findOneOnlineAgentById considering Livechat_enabled_when_agent_idle and Livechat_accept_chats_with_no_agents; a null result throws Meteor.Error('error-agent-status-service-offline', 'Agent status is offline or Omnichannel service is not active'). In TEST_MODE the error payload includes the relevant settings and the raw user doc for debugging.

Source

Thrown at apps/meteor/server/lib/omnichannel/takeInquiry.ts:36

		throw new Meteor.Error('error-not-found', 'Inquiry not found', {
			method: 'livechat:takeInquiry',
		});
	}

	if (inquiry.status === 'taken') {
		throw new Meteor.Error('error-inquiry-taken', 'Inquiry already taken', {
			method: 'livechat:takeInquiry',
		});
	}

	const user = await Users.findOneOnlineAgentById(
		userId,
		settings.get<boolean>('Livechat_enabled_when_agent_idle'),
		settings.get<boolean>('Livechat_accept_chats_with_no_agents'),
		{},
	);
	if (!user) {
		throw new Meteor.Error('error-agent-status-service-offline', 'Agent status is offline or Omnichannel service is not active', {
			method: 'livechat:takeInquiry',
			...(process.env.TEST_MODE && {
				Livechat_enabled_when_agent_idle: settings.get<boolean>('Livechat_enabled_when_agent_idle'),
				Livechat_accept_chats_with_no_agents: settings.get<boolean>('Livechat_accept_chats_with_no_agents'),
				user: await Users.findOneById(userId),
			}),
		});
	}

	const room = await LivechatRooms.findOneById(inquiry.rid);
	if (!room || !(await Omnichannel.isWithinMACLimit(room))) {
		throw new Meteor.Error('error-mac-limit-reached');
	}

	const contactId = room.contactId ?? (await migrateVisitorIfMissingContact(room.v._id, room.source));
	if (contactId) {
		const isAgentAvailableToTakeContactInquiryResult = await isAgentAvailableToTakeContactInquiry(inquiry.v._id, room.source, contactId);
		if (!isAgentAvailableToTakeContactInquiryResult.value) {

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Have the agent set their status back to online (avatar menu > online) and retry
  2. Check Livechat_enabled_when_agent_idle — enable it if idle agents must still take inquiries
  3. Verify the user appears in Omnichannel > Agents with an online status
  4. Inspect LivechatAgentActivityMonitor behavior/auto-away settings if statuses flip unexpectedly; keep a live websocket connection so presence stays online
Defensive patterns

Strategy: validation

Validate before calling

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

const onlineAgent = await Users.findOneOnlineAgentById(
  userId,
  settings.get<boolean>('Livechat_enabled_when_agent_idle'),
  settings.get<boolean>('Livechat_accept_chats_with_no_agents'),
);
if (!onlineAgent) {
  throw new Meteor.Error('error-agent-status-service-offline', 'Set status online before taking inquiries');
}
await Meteor.callAsync('livechat:takeInquiry', inquiryId);

Try / catch

try {
  await Meteor.callAsync('livechat:takeInquiry', inquiryId);
} catch (err) {
  if (err instanceof Meteor.Error && err.error === 'error-agent-status-service-offline') {
    // prompt the agent to go online / reconnect, then retry after status change
  } else {
    throw err;
  }
}

Prevention

When it happens

Trigger: Calling livechat:takeInquiry while the taking user is not seen as an online agent: user status offline/busy/away, agent idle with Livechat_enabled_when_agent_idle=false, the user not being an omnichannel agent at all, or their livechat status derived as offline.

Common situations: Agent's socket dropped so LivechatAgentActivityMonitor flipped them to away/idle, agent set themselves away then tried to grab a chat from a stale UI, API/scripted calls without an active connection, or default auto-away settings marking the agent idle.

Related errors


AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18). Data as JSON: /api/errors/908474aed86c5a63. Report an issue: GitHub.