{"record":{"id":"9dacf40b9dc5c61a","repo":"RocketChat/Rocket.Chat","slug":"the-agent-with-id-agent-id-was-not-found","errorCode":null,"errorMessage":"The agent with id \"${agent.id}\" was not found.","messagePattern":"The agent with id \"(.+?)\" was not found\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/app/apps/server/bridges/livechat.ts","lineNumber":114,"sourceCode":"\t\t};\n\n\t\t// @ts-expect-error IVisitor vs ILivechatVisitor :(\n\t\tawait updateMessage(data);\n\t}\n\n\tprotected async createRoom(\n\t\tvisitor: IVisitor,\n\t\tagent: IUser,\n\t\tappId: string,\n\t\t{ source, customFields }: IExtraRoomParams = {},\n\t): Promise<ILivechatRoom> {\n\t\tthis.orch.debugLog(`The App ${appId} is creating a livechat room.`);\n\n\t\tlet agentRoom: SelectedAgent | undefined;\n\t\tif (agent?.id) {\n\t\t\tconst user = await Users.getAgentInfo(agent.id, settings.get('Livechat_show_agent_email'));\n\t\t\tif (!user) {\n\t\t\t\tthrow new Error(`The agent with id \"${agent.id}\" was not found.`);\n\t\t\t}\n\t\t\tagentRoom = { agentId: user._id, username: user.username };\n\t\t}\n\n\t\tconst room = await createRoom({\n\t\t\tvisitor: this.orch.getConverters()?.get('visitors').convertAppVisitor(visitor),\n\t\t\troomInfo: {\n\t\t\t\tsource: {\n\t\t\t\t\ttype: OmnichannelSourceType.APP,\n\t\t\t\t\tid: appId,\n\t\t\t\t\talias: this.orch.getManager()?.getOneById(appId)?.getName(),\n\t\t\t\t\t...(source?.type === 'app' && {\n\t\t\t\t\t\tsidebarIcon: source.sidebarIcon,\n\t\t\t\t\t\tdefaultIcon: source.defaultIcon,\n\t\t\t\t\t\tlabel: source.label,\n\t\t\t\t\t\tdestination: source.destination,\n\t\t\t\t\t}),\n\t\t\t\t},","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/2a7de457074cbb4d4373fbd9a4e5bea292c9c764/apps/meteor/app/apps/server/bridges/livechat.ts#L96-L132","documentation":"Error \"The agent with id \"${agent.id}\" was not found.\" thrown in RocketChat/Rocket.Chat.","triggerScenarios":"Thrown at apps/meteor/app/apps/server/bridges/livechat.ts:114 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the agent id refers to an existing user with the livechat-agent role via Users.getAgentInfo.","Create or enable the agent account first, or omit the agent to let routing assign one automatically."],"exampleFix":"Ensure the agent exists before assigning: const agentUser = await Users.findOneById(agent.id); if (!agentUser) { throw new Error(`The agent with id \"${agent.id}\" was not found.`); }","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2a7de457074cbb4d4373fbd9a4e5bea292c9c764","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}