RocketChat/Rocket.Chat · error
error-user-is-offline
error-user-is-offline
Error message
error-user-is-offline
What it means
forwardRoomToAgent resolves the target with Users.findOneOnlineAgentById(agentId, Livechat_enabled_when_agent_idle, Livechat_accept_chats_with_no_agents); a null result throws error-user-is-offline. Whether away/busy/idle agents count as online depends on those two settings, so the same agent can be a valid forward target on one workspace and not on another.
Source
Thrown at apps/meteor/server/lib/omnichannel/Helper.ts:510
userId: transferData.userId,
});
const { userId: agentId, clientAction } = transferData;
if (!agentId) {
throw new Error('error-invalid-agent');
}
const user = await Users.findOneOnlineAgentById(
agentId,
settings.get<boolean>('Livechat_enabled_when_agent_idle'),
settings.get<boolean>('Livechat_accept_chats_with_no_agents'),
{},
);
if (!user) {
logger.debug({
msg: 'Agent is offline. Cannot forward',
agentId,
});
throw new Error('error-user-is-offline');
}
const { _id: rid, servedBy: oldServedBy } = room;
const inquiry = await LivechatInquiry.findOneByRoomId(rid, {});
if (!inquiry) {
logger.debug({
msg: 'No inquiries found for room. Cannot forward',
roomId: room._id,
});
throw new Error('error-invalid-inquiry');
}
if (oldServedBy && agentId === oldServedBy._id) {
throw new Error('error-selected-agent-room-agent-are-same');
}
const { username } = user;
const agent = { agentId, username };View on GitHub (pinned to b2c16d5842)
Solutions
- Pick a different online agent, or forward to the department queue instead
- Enable Livechat_enabled_when_agent_idle if business rules allow idle agents to receive forwards
- Check the target agent's livechat availability toggle and connection before retrying
Defensive patterns
Strategy: validation
Validate before calling
const agent = await Users.findOneOnlineAgentById(
agentId,
settings.get('Livechat_enabled_when_agent_idle'),
settings.get('Livechat_accept_chats_with_no_agents'),
{ projection: { _id: 1 } },
);
if (!agent) {
// pick another agent or forward to the department queue instead
} Try / catch
try {
await forwardRoomToAgent(room, transferData, guest);
} catch (err) {
if (err instanceof Error && err.message === 'error-user-is-offline') {
// offer department forward or another online agent
} else throw err;
} Prevention
- Show live agent availability in the transfer dialog before submit
- Tune Livechat_enabled_when_agent_idle to match your routing policy
- Prefer department forwards when agent availability is uncertain
When it happens
Trigger: Forwarding a livechat room to an agent whose status is away/busy while Livechat_enabled_when_agent_idle is false; agent logged out mid-shift; agent turned off their livechat availability.
Common situations: Agents forgetting to return status to online; retrying a forward after the target agent went idle; workspace tightened the idle-agent settings.
Related errors
- error-invalid-agent
- error-invalid-inquiry
- error-selected-agent-room-agent-are-same
- error-transferring-inquiry
- error-transferring-inquiry-no-department
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/38fb0b92b5a39835.
Report an issue: GitHub.