RocketChat/Rocket.Chat · error · Error

The agent with id " " was not found.

Error message

The agent with id "${agent.id}" was not found.

What it means

Error "The agent with id "${agent.id}" was not found." thrown in RocketChat/Rocket.Chat.

Solutions

  1. Verify the agent id refers to an existing user with the livechat-agent role via Users.getAgentInfo.
  2. Create or enable the agent account first, or omit the agent to let routing assign one automatically.

Example fix

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.`); }

When it happens

Trigger: Thrown at apps/meteor/app/apps/server/bridges/livechat.ts:114 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of RocketChat/Rocket.Chat@2a7de45707 (2026-08-18). Data as JSON: /api/errors/9dacf40b9dc5c61a. Report an issue: GitHub.

Appendix: source

Thrown at apps/meteor/app/apps/server/bridges/livechat.ts:114

		};

		// @ts-expect-error IVisitor vs ILivechatVisitor :(
		await updateMessage(data);
	}

	protected async createRoom(
		visitor: IVisitor,
		agent: IUser,
		appId: string,
		{ source, customFields }: IExtraRoomParams = {},
	): Promise<ILivechatRoom> {
		this.orch.debugLog(`The App ${appId} is creating a livechat room.`);

		let agentRoom: SelectedAgent | undefined;
		if (agent?.id) {
			const user = await Users.getAgentInfo(agent.id, settings.get('Livechat_show_agent_email'));
			if (!user) {
				throw new Error(`The agent with id "${agent.id}" was not found.`);
			}
			agentRoom = { agentId: user._id, username: user.username };
		}

		const room = await createRoom({
			visitor: this.orch.getConverters()?.get('visitors').convertAppVisitor(visitor),
			roomInfo: {
				source: {
					type: OmnichannelSourceType.APP,
					id: appId,
					alias: this.orch.getManager()?.getOneById(appId)?.getName(),
					...(source?.type === 'app' && {
						sidebarIcon: source.sidebarIcon,
						defaultIcon: source.defaultIcon,
						label: source.label,
						destination: source.destination,
					}),
				},

View on GitHub (pinned to 2a7de45707)