RocketChat/Rocket.Chat · warning

Saving page history without room id for visitor

Error message

Saving page history without room id for visitor

What it means

savePageHistory records a livechat visitor's page navigation as a 'livechat_navigation_history' system message inside the chat room. When roomId is falsy — visitor browsing before any conversation started, or the caller did not resolve a room — the message cannot be attached to a room; it is still saved but tagged with a 30-day TTL (2592000000 ms) so orphan records expire automatically.

Source

Thrown at apps/meteor/server/lib/omnichannel/tracking.ts:42

	const pageTitle = pageInfo.title;
	const pageUrl = pageInfo.location.href;
	const extraData: {
		navigation: {
			page: PageInfo;
			token: string;
		};
		expireAt?: number;
		_hidden?: boolean;
	} = {
		navigation: {
			page: pageInfo,
			token,
		},
	};

	if (!roomId) {
		livechatLogger.warn({ msg: 'Saving page history without room id for visitor', token });
		// keep history of unregistered visitors for 1 month
		const keepHistoryMiliseconds = 2592000000;
		extraData.expireAt = new Date().getTime() + keepHistoryMiliseconds;
	}

	if (!settings.get('Livechat_Visitor_navigation_as_a_message')) {
		extraData._hidden = true;
	}

	// @ts-expect-error: Investigating on which case we won't receive a roomId and where that history is supposed to be stored
	return Message.saveSystemMessage('livechat_navigation_history', roomId, `${pageTitle} - ${pageUrl}`, user, extraData);
}

View on GitHub (pinned to b2c16d5842)

Solutions

  1. No action if you intentionally keep navigation history of unregistered visitors — records auto-expire after 1 month
  2. If these records are unwanted, restrict the pages where the Livechat monitoring script runs
  3. To attach history to rooms, ensure the visitor has an open room before sending page events (start the chat first)
  4. Audit orphan volume by querying messages with t='livechat_navigation_history' and expireAt set
Defensive patterns

Strategy: validation

Validate before calling

if (!roomId) {
  // skip persisting, or defer until the visitor opens a room — do not save room-less history silently
  livechatLogger.debug({ msg: 'Skipping page history — no room for visitor', token });
  return;
}

Prevention

When it happens

Trigger: Omnichannel page-tracking events arriving with no roomId: visitor landed on a tracked page but never opened a chat, or an integration fired tracking events without resolving the room first.

Common situations: Websites with the Livechat monitoring script on all pages; visitors who browse but never start a conversation; custom widgets that send page.visited before room creation.

Related errors


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