RocketChat/Rocket.Chat · critical · Error

Could not get the message converter to process livechat room

Error message

Could not get the message converter to process livechat room messages

What it means

Thrown by AppLivechatBridge._fetchLivechatRoomMessages when this.orch.getConverters()?.get('messages') returns undefined. The message converter is a core dependency of the orchestrator; its absence means the orchestrator was not initialized correctly, so the transcript fetch cannot map persisted messages to apps-engine objects.

Source

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

			.convertDepartment(await LivechatDepartment.findOneByIdOrName(value, {}));
	}

	protected async findDepartmentsEnabledWithAgents(appId: string): Promise<Array<IDepartment>> {
		this.orch.debugLog(`The App ${appId} is looking for livechat departments.`);

		const converter = this.orch.getConverters()?.get('departments');
		// #TODO: #AppsEngineTypes - Remove explicit types and typecasts once the apps-engine definition/implementation mismatch is fixed.
		const boundConverter = converter.convertDepartment.bind(converter) as (_: ILivechatDepartment) => Promise<IDepartment>;

		return Promise.all((await LivechatDepartment.findEnabledWithAgents().toArray()).map(boundConverter));
	}

	protected async _fetchLivechatRoomMessages(appId: string, roomId: string): Promise<Array<IAppsEngineMessage>> {
		this.orch.debugLog(`The App ${appId} is getting the transcript for livechat room ${roomId}.`);
		const messageConverter = this.orch.getConverters()?.get('messages');

		if (!messageConverter) {
			throw new Error('Could not get the message converter to process livechat room messages');
		}

		const livechatMessages = await getRoomMessages({ rid: roomId });
		return Promise.all(await livechatMessages.map((message) => messageConverter.convertMessage(message, livechatMessages)).toArray());
	}

	protected async setCustomFields(
		data: { token: IVisitor['token']; key: string; value: string; overwrite: boolean },
		appId: string,
	): Promise<number> {
		this.orch.debugLog(`The App ${appId} is setting livechat visitor's custom fields.`);

		return setCustomFields(data);
	}
}

View on GitHub (pinned to f9d3ec372b)

Solutions

  1. Confirm the orchestrator completed initialization (all converters registered) before Apps are allowed to run.
  2. Verify the apps-engine bridge/converter wiring is intact in the current build (no missing import/registration).
  3. Reinstall/restart the server so the orchestrator re-registers converters on boot.
  4. If forking, ensure the 'messages' converter is added to the orchestrator's converter map.
Defensive patterns

Strategy: validation

Validate before calling

const messageConverter = this.orch.getConverters()?.get('messages');
if (!messageConverter) {
  throw new Error('Orchestrator not initialized: message converter missing. Restart/reinstall the server.');
}
return messageConverter;

Type guard

const hasMessageConverter = (orch: IAppServerOrchestrator): boolean =>
  Boolean(orch.getConverters()?.get('messages'));

Try / catch

try {
  return await app.getLivechatRead().getMessages(roomId);
} catch (e) {
  if ((e as Error).message.includes('message converter')) {
    // surface as a server misconfiguration; do not retry until restart
  }
  throw e;
}

Prevention

When it happens

Trigger: An App requests a livechat room transcript (e.g. app.getLivechatRead().getMessages(roomId)); the orchestrator's converter registry does not contain a 'messages' converter, returning undefined.

Common situations: Orchestrator initialization order changed and converters were not registered before the App call; a custom/forked build omitted the message converter; a partial apps-engine upgrade where the converter key was renamed; the App invoked the accessor before server startup finished initializing the orchestrator.

Related errors


AI-assisted analysis of RocketChat/Rocket.Chat@f9d3ec372b (2026-08-12). Data as JSON: /api/errors/058bf3fcc1fb9197. Report an issue: GitHub.