{"record":{"id":"d719c76fe3a90081","repo":"remotion-dev/remotion","slug":"multiple-composition-with-id-comp-id-are-regist","errorCode":null,"errorMessage":"Multiple composition with id ${comp.id} are registered.","messagePattern":"Multiple composition with id (.+?) are registered\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/CompositionManagerProvider.tsx","lineNumber":64,"sourceCode":"\n\tconst updateCompositions = useCallback(\n\t\t(updateComps: (comp: AnyComposition[]) => AnyComposition[]) => {\n\t\t\tsetCompositions((comps) => {\n\t\t\t\tconst updated = updateComps(comps);\n\t\t\t\tcurrentcompositionsRef.current = updated;\n\t\t\t\treturn updated;\n\t\t\t});\n\t\t},\n\t\t[],\n\t);\n\n\tconst registerComposition = useCallback(\n\t\t<Schema extends AnyZodObject, Props extends Record<string, unknown>>(\n\t\t\tcomp: TComposition<Schema, Props>,\n\t\t) => {\n\t\t\tupdateCompositions((comps) => {\n\t\t\t\tif (comps.find((c) => c.id === comp.id)) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Multiple composition with id ${comp.id} are registered.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn [...comps, comp] as AnyComposition[];\n\t\t\t});\n\t\t},\n\t\t[updateCompositions],\n\t);\n\n\tconst unregisterComposition = useCallback((id: string) => {\n\t\tsetCompositions((comps) => {\n\t\t\treturn comps.filter((c) => c.id !== id);\n\t\t});\n\t}, []);\n\n\tconst registerFolder = useCallback(\n\t\t(","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/CompositionManagerProvider.tsx#L46-L82","documentation":"Thrown by CompositionManagerProvider.registerComposition when a second composition is registered with an id that already exists in the compositions list. Remotion uses ids as the unique key for the CLI (`--props`, `render <id>`), for Studio routing, and for render selection, so duplicates would create ambiguous resolution. The check fires inside the setCompositions updater so it runs once per composition registration.","triggerScenarios":"Two `<Composition id=\"x\" />` entries in the same Root; dynamically generating compositions from an array where ids collide; copy-paste of a Composition block without renaming the id; a Composition and a Still sharing the same id.","commonSituations":"Large Root files where ids drift; refactor that splits a file and duplicates an id; programmatic composition generation from a list that has duplicate keys; migration from one project template that leaves a leftover Composition.","solutions":["Search your Root for the id reported in the message (`${comp.id}`) and rename the duplicate.","If generating compositions from data, derive the id from a guaranteed-unique field (e.g. slug, uuid) rather than title.","Remove or rename the older entry so each id appears exactly once across <Composition>, <Still>, and <Folder>.","Run `bunx remotion compositions` after the fix to confirm each id is listed exactly once."],"exampleFix":"// before\n<Composition id=\"intro\" component={Intro} ... />\n<Composition id=\"intro\" component={IntroV2} ... />\n// after\n<Composition id=\"intro\" component={Intro} ... />\n<Composition id=\"intro-v2\" component={IntroV2} ... />","handlingStrategy":"validation","validationCode":"const ids = compositions.map((c) => c.id);\nconst dupes = ids.filter((id, i) => ids.indexOf(id) !== i);\nif (dupes.length > 0) {\n  throw new Error(`Duplicate composition ids: ${dupes.join(', ')}`);\n}","typeGuard":"const hasUniqueIds = (list: ReadonlyArray<{id: string}>): boolean =>\n  new Set(list.map((c) => c.id)).size === list.length;","tryCatchPattern":null,"preventionTips":["Centralize composition definitions in a single typed array and dedupe by id at build time.","Derive ids from guaranteed-unique slugs/uuids when generating from data.","Add a pre-commit script that fails if any id appears more than once.","Run `bunx remotion compositions` and visually verify no id repeats."],"tags":["composition","duplicate-id","root-registration","validation"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}