RocketChat/Rocket.Chat · info · OldUrlRoomError

old-url-format

old-url-format

Error message

Old Url Format

What it means

Thrown as OldUrlRoomError ('old-url-format') right after successfully creating a DM and pushing the new rid onto the direct route. It is a control-flow signal, not a real failure: it aborts the current queryFn so the OldUrlRoomError is caught by react-query's retry logic (which disables retries) and triggers a re-render against the newly pushed rid route.

Source

Thrown at apps/meteor/client/views/room/hooks/useOpenRoom.ts:105

				}

				if (errorCode !== 'error-invalid-room') {
					throw error;
				}

				if (type !== 'd') {
					throw new RoomNotFoundError(undefined, { type, reference });
				}

				try {
					const { room } = await createDirectMessage({ usernames: reference });

					directRoute.push({ rid: room._id }, (prev) => prev);
				} catch (error) {
					throw new RoomNotFoundError(undefined, { type, reference });
				}

				throw new OldUrlRoomError(undefined, { type, reference });
			}

			if (!roomData._id) {
				throw new RoomNotFoundError(undefined, { type, reference });
			}

			const unsetKeys = getObjectKeys(roomData).filter((key) => !(key in roomFields));
			unsetKeys.forEach((key) => {
				delete roomData[key];
			});
			Rooms.state.store(roomData);

			const room = Rooms.state.get(roomData._id);

			if (!room) {
				throw new TypeError('room is undefined');
			}

View on GitHub (pinned to f9d3ec372b)

Solutions

  1. Do not 'fix' this throw — it is intentional. Ensure downstream error UI treats OldUrlRoomError as a redirect signal, not a user-facing error.
  2. If the error leaks to the UI, verify the retry function lists OldUrlRoomError as unrecoverable and that the route change triggers a fresh query.
  3. Keep directRoute.push before the throw so the new rid URL is in place when the query re-runs.
Defensive patterns

Strategy: try-catch

Type guard

const isOldUrlRedirect = (e: unknown): boolean => e instanceof OldUrlRoomError;

Try / catch

// Treat OldUrlRoomError as a silent redirect, not a user-facing error.
if (error instanceof OldUrlRoomError) {
  // route push already happened; just suppress the error UI
  return null;
}

Prevention

When it happens

Trigger: Opening a /direct/username URL where the DM didn't exist; im.create succeeds, direct route is pushed with the real rid, and this error halts the now-stale query against the username-based reference.

Common situations: Normal flow whenever a legacy username-based DM URL is opened for the first time; not a bug — it is the mechanism that forces the route to switch to the rid-based URL.

Related errors


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