{"record":{"id":"efc57fe5d3623f10","repo":"remotion-dev/remotion","slug":"composition-was-mounted-inside-the-component-t","errorCode":null,"errorMessage":"<Composition> was mounted inside the `component` that was passed to the <Player>. See https://remotion.dev/docs/wrong-composition-mount for help.","messagePattern":"<Composition> was mounted inside the `component` that was passed to the <Player>\\. See https://remotion\\.dev/docs/wrong-composition-mount for help\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/Composition.tsx","lineNumber":173,"sourceCode":"\t});\n\n\tconst nonce = useNonce();\n\n\tconst isPlayer = useIsPlayer();\n\tconst environment = useRemotionEnvironment();\n\n\tconst canUseComposition = useContext(CanUseRemotionHooks);\n\n\t// Record seen composition IDs as early as possible so that overlays can access them\n\tif (typeof window !== 'undefined') {\n\t\twindow.remotion_seenCompositionIds = Array.from(\n\t\t\tnew Set([...(window.remotion_seenCompositionIds ?? []), id]),\n\t\t);\n\t}\n\n\tif (canUseComposition) {\n\t\tif (isPlayer) {\n\t\t\tthrow new Error(\n\t\t\t\t'<Composition> was mounted inside the `component` that was passed to the <Player>. See https://remotion.dev/docs/wrong-composition-mount for help.',\n\t\t\t);\n\t\t}\n\n\t\tthrow new Error(\n\t\t\t'<Composition> mounted inside another composition. See https://remotion.dev/docs/wrong-composition-mount for help.',\n\t\t);\n\t}\n\n\tconst {folderName, parentName} = useContext(FolderContext);\n\tconst stack =\n\t\t(compProps as {readonly _remotionInternalStack?: string})\n\t\t\t._remotionInternalStack ?? null;\n\tconst componentFromProps =\n\t\t'component' in compProps ? compProps.component : null;\n\n\tuseEffect(() => {\n\t\t// Ensure it's a URL safe id","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/Composition.tsx#L155-L191","documentation":"Thrown by <Composition> when it mounts inside the `component` prop passed to <Player>. Compositions must be registered at the top level of a Remotion root, not nested inside a player's render component; mounting one there is a structural mistake that breaks the player's render model.","triggerScenarios":"Passing a `component` to <Player> whose JSX includes a <Composition> element. The CanUseRemotionHooks + isPlayer context flags this exact misconfiguration.","commonSituations":"Reusing a Root component (which lists <Composition>s) as a Player component; wrapping a <Player> inside a <Composition>; copy-paste of root registration code into a player component.","solutions":["Pass a plain presentational component to <Player> — never one that registers <Composition>s.","Keep <Composition> registration strictly inside the Remotion <Root>.","See https://remotion.dev/docs/wrong-composition-mount."],"exampleFix":"// before\n<Player\n  component={MyRoot} // MyRoot contains <Composition>\n  .../>\n\n// after\n<Player\n  component={MyVideo} // a pure video component, no <Composition> inside\n  .../>","handlingStrategy":"type-guard","validationCode":"// Ensure the component passed to <Player> contains no <Composition>.\n// Player components should be pure presentational components, not Root registrations.","typeGuard":"function isPlainPlayerComponent(comp: React.FC<any>): boolean {\n  // Static review: the component must not import or render <Composition>.\n  // Enforce via eslint-rule 'no-restricted-imports' blocking @remotion/core's Composition in player components.\n  return true;\n}","tryCatchPattern":"null","preventionTips":["Never reuse the Remotion Root component as a Player component.","Keep composition registration strictly inside <Root>.","Review the Player component tree for stray <Composition> usage."],"tags":["typescript","remotion","player","composition","react","misuse"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}