remotion-dev/remotion · critical · Error

You must pass a React component to registerRoot(), but ${JSO

Error message

You must pass a React component to registerRoot(), but ${JSON.stringify(comp)} was passed.

What it means

registerRoot(comp) is the entry point that registers your composition tree with Remotion. A falsy comp (undefined, null, 0, '') means the root file exported nothing or a broken value, so Remotion refuses to register it and serializes the bad value into the message.

Source

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

import type React from 'react';

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;

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Ensure the argument is a React component: registerRoot(MyComposition).
  2. Check the import actually resolves to a function/FC.
  3. Default-export your root component and import it correctly.

Example fix

// before
registerRoot(undefined);
// after
registerRoot(RemotionRoot);
Defensive patterns

Strategy: validation

Validate before calling

if (typeof comp === 'function') {
  registerRoot(comp);
} else {
  throw new Error('registerRoot needs a React component');
}

Type guard

const isReactComponent = (v: unknown): v is React.FC =>
  typeof v === 'function';

Prevention

When it happens

Trigger: Calling registerRoot(undefined); importing a composition that does not exist; a default import resolving to undefined; a circular import returning undefined.

Common situations: Wrong/missing default export in the entry file; misconfigured bundler entry; refactoring that breaks the exported symbol.

Related errors


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