RocketChat/Rocket.Chat · error

error-no-agents-available-for-service-on-department

error-no-agents-available-for-service-on-department

Error message

error-no-agents-available-for-service-on-department

What it means

After a department forward, if the chat was not queued and ended up assigned to the same agent it already had, and the target department has no fallbackForwardDepartment configured (an Enterprise feature), the transfer fails with error-no-agents-available-for-service-on-department. On CE there is no livechat:onTransferFailure callback, so no fallback path exists at all.

Source

Thrown at apps/meteor/server/lib/omnichannel/Helper.ts:748

	);
	if (!roomTaken) {
		logger.debug({
			msg: 'Cannot forward room. Unable to delegate inquiry',
			roomId: room._id,
		});
		return false;
	}

	const { servedBy, chatQueued } = roomTaken;
	if (!chatQueued && oldServedBy && oldServedBy._id === servedBy?._id) {
		if (!department?.fallbackForwardDepartment?.length) {
			logger.debug({
				msg: 'Cannot forward room. Chat assigned to agent instead',
				roomId: room._id,
				agentId: servedBy._id,
				previousAgentId: oldServedBy._id,
			});
			throw new Error('error-no-agents-available-for-service-on-department');
		}

		if (!transferData.originalDepartmentName) {
			transferData.originalDepartmentName = department.name;
		}
		// if a chat has a fallback department, attempt to redirect chat to there [EE]
		const transferSuccess = !!(await callbacks.run('livechat:onTransferFailure', room, { guest, transferData, department }));
		// On CE theres no callback so it will return the room
		if (typeof transferSuccess !== 'boolean' || !transferSuccess) {
			logger.debug({
				msg: 'Cannot forward room. Unable to delegate inquiry',
				roomId: room._id,
			});
			return false;
		}

		return true;
	}

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Add more online agents to the target department or wait for availability
  2. Configure the department's fallback forward department (EE) so failed forwards delegate elsewhere
  3. Fall back to forwarding directly to a specific online agent
Defensive patterns

Strategy: fallback

Validate before calling

const dept = await LivechatDepartment.findOneById(departmentId, {
  projection: { fallbackForwardDepartment: 1, allowReceiveForwardOffline: 1 },
});
if (!dept?.fallbackForwardDepartment?.length) {
  // CE or unconfigured fallback: expect this failure; plan an alternate target
}

Try / catch

try {
  await forwardRoomToDepartment(room, transferData, guest);
} catch (err) {
  if (err instanceof Error && err.message === 'error-no-agents-available-for-service-on-department') {
    // fallback: forward directly to a known online agent, or keep current agent and notify
  } else throw err;
}

Prevention

When it happens

Trigger: Forwarding to a department whose only available agent is the one currently serving the chat; all other department agents offline; fallbackForwardDepartment unset, set to itself, or unreachable; community edition installs.

Common situations: Small departments staffed by a single agent; night shifts; fallback chain never configured after upgrade; CE deployments hitting an EE-only behavior.

Related errors


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