remotion-dev/remotion · critical · Error

registerRoot() was called more than once.

Error message

registerRoot() was called more than once.

What it means

Remotion expects exactly one registerRoot() call per entry bundle because it defines the single root of the composition tree. If `Root` is already set, a second call throws to prevent ambiguous registration.

Source

Thrown at packages/core/src/register-root.ts:21

let Root: React.FC | null = null;

let listeners: ((comp: React.FC) => void)[] = [];

/*
 * @description Registers the root component of the Remotion project.
 * @see [Documentation](https://www.remotion.dev/docs/register-root)
 */
export const registerRoot = (comp: React.FC) => {
	if (!comp) {
		throw new Error(
			`You must pass a React component to registerRoot(), but ${JSON.stringify(
				comp,
			)} was passed.`,
		);
	}

	if (Root) {
		throw new Error('registerRoot() was called more than once.');
	}

	Root = comp;
	listeners.forEach((l) => {
		l(comp);
	});
};

export const getRoot = () => {
	return Root;
};

export const waitForRoot = (fn: (comp: React.FC) => void): (() => void) => {
	if (Root) {
		fn(Root);
		return () => undefined;
	}

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Remove the duplicate registerRoot() call.
  2. Ensure the entry file is imported/executed only once.
  3. Check the bundler/CLI for multiple entry points pointing to the same module.

Example fix

// before
registerRoot(RootA);
registerRoot(RootB);
// after
registerRoot(RootA);
Defensive patterns

Strategy: validation

Validate before calling

// Ensure only one entry invokes registerRoot; guard with a module flag
if (!globalThis.__remotionRootRegistered) {
  globalThis.__remotionRootRegistered = true;
  registerRoot(Root);
}

Prevention

When it happens

Trigger: Two registerRoot() calls in the same bundle; an entry file imported twice causing side effects to re-run; HMR re-invoking the module; multiple entry points bundled together.

Common situations: Copy-paste leftover adding a second call; bundler config merging multiple entry files; stale HMR cache.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/21e831eb33c092ff. Report an issue: GitHub.