{"record":{"id":"219cfbfc5eda1153","repo":"RocketChat/Rocket.Chat","slug":"error-no-agents-available-for-service-on-departmen","errorCode":"error-no-agents-available-for-service-on-department","errorMessage":"error-no-agents-available-for-service-on-department","messagePattern":"error-no-agents-available-for-service-on-department","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/meteor/server/lib/omnichannel/Helper.ts","lineNumber":748,"sourceCode":"\t);\n\tif (!roomTaken) {\n\t\tlogger.debug({\n\t\t\tmsg: 'Cannot forward room. Unable to delegate inquiry',\n\t\t\troomId: room._id,\n\t\t});\n\t\treturn false;\n\t}\n\n\tconst { servedBy, chatQueued } = roomTaken;\n\tif (!chatQueued && oldServedBy && oldServedBy._id === servedBy?._id) {\n\t\tif (!department?.fallbackForwardDepartment?.length) {\n\t\t\tlogger.debug({\n\t\t\t\tmsg: 'Cannot forward room. Chat assigned to agent instead',\n\t\t\t\troomId: room._id,\n\t\t\t\tagentId: servedBy._id,\n\t\t\t\tpreviousAgentId: oldServedBy._id,\n\t\t\t});\n\t\t\tthrow new Error('error-no-agents-available-for-service-on-department');\n\t\t}\n\n\t\tif (!transferData.originalDepartmentName) {\n\t\t\ttransferData.originalDepartmentName = department.name;\n\t\t}\n\t\t// if a chat has a fallback department, attempt to redirect chat to there [EE]\n\t\tconst transferSuccess = !!(await callbacks.run('livechat:onTransferFailure', room, { guest, transferData, department }));\n\t\t// On CE theres no callback so it will return the room\n\t\tif (typeof transferSuccess !== 'boolean' || !transferSuccess) {\n\t\t\tlogger.debug({\n\t\t\t\tmsg: 'Cannot forward room. Unable to delegate inquiry',\n\t\t\t\troomId: room._id,\n\t\t\t});\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}","sourceCodeStart":730,"sourceCodeEnd":766,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/lib/omnichannel/Helper.ts#L730-L766","documentation":"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.","triggerScenarios":"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.","commonSituations":"Small departments staffed by a single agent; night shifts; fallback chain never configured after upgrade; CE deployments hitting an EE-only behavior.","solutions":["Add more online agents to the target department or wait for availability","Configure the department's fallback forward department (EE) so failed forwards delegate elsewhere","Fall back to forwarding directly to a specific online agent"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"const dept = await LivechatDepartment.findOneById(departmentId, {\n  projection: { fallbackForwardDepartment: 1, allowReceiveForwardOffline: 1 },\n});\nif (!dept?.fallbackForwardDepartment?.length) {\n  // CE or unconfigured fallback: expect this failure; plan an alternate target\n}","typeGuard":null,"tryCatchPattern":"try {\n  await forwardRoomToDepartment(room, transferData, guest);\n} catch (err) {\n  if (err instanceof Error && err.message === 'error-no-agents-available-for-service-on-department') {\n    // fallback: forward directly to a known online agent, or keep current agent and notify\n  } else throw err;\n}","preventionTips":["Configure fallbackForwardDepartment on departments (EE) to absorb routing failures","Staff departments with more than one online agent during peak hours","On CE, wrap department forwards with an agent-forward fallback in your integration"],"tags":["omnichannel","livechat","transfer","routing","no-agents","rocket-chat"],"backgroundTag":"no-agents-available","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}