{"record":{"id":"1a1a7f9ceadc48ff","repo":"remotion-dev/remotion","slug":"you-must-pass-a-react-component-to-registerroot","errorCode":null,"errorMessage":"You must pass a React component to registerRoot(), but ${JSON.stringify(comp)} was passed.","messagePattern":"You must pass a React component to registerRoot\\(\\), but (.+?) was passed\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/core/src/register-root.ts","lineNumber":13,"sourceCode":"import type React from 'react';\n\nlet Root: React.FC | null = null;\n\nlet listeners: ((comp: React.FC) => void)[] = [];\n\n/*\n * @description Registers the root component of the Remotion project.\n * @see [Documentation](https://www.remotion.dev/docs/register-root)\n */\nexport const registerRoot = (comp: React.FC) => {\n\tif (!comp) {\n\t\tthrow new Error(\n\t\t\t`You must pass a React component to registerRoot(), but ${JSON.stringify(\n\t\t\t\tcomp,\n\t\t\t)} was passed.`,\n\t\t);\n\t}\n\n\tif (Root) {\n\t\tthrow new Error('registerRoot() was called more than once.');\n\t}\n\n\tRoot = comp;\n\tlisteners.forEach((l) => {\n\t\tl(comp);\n\t});\n};\n\nexport const getRoot = () => {\n\treturn Root;","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/register-root.ts#L1-L31","documentation":"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.","triggerScenarios":"Calling registerRoot(undefined); importing a composition that does not exist; a default import resolving to undefined; a circular import returning undefined.","commonSituations":"Wrong/missing default export in the entry file; misconfigured bundler entry; refactoring that breaks the exported symbol.","solutions":["Ensure the argument is a React component: registerRoot(MyComposition).","Check the import actually resolves to a function/FC.","Default-export your root component and import it correctly."],"exampleFix":"// before\nregisterRoot(undefined);\n// after\nregisterRoot(RemotionRoot);","handlingStrategy":"validation","validationCode":"if (typeof comp === 'function') {\n  registerRoot(comp);\n} else {\n  throw new Error('registerRoot needs a React component');\n}","typeGuard":"const isReactComponent = (v: unknown): v is React.FC =>\n  typeof v === 'function';","tryCatchPattern":null,"preventionTips":["Ensure the entry file default-exports a React component.","Verify the import path resolves to the component.","Check for circular imports that yield undefined."],"tags":["register-root","startup","entry-point"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}