{"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":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/CompositionManagerProvider.tsx","lineNumber":102,"sourceCode":"\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\tconst orderKey = getCompositionAndFolderOrderKey({\n\t\t\t\ttype: 'composition',\n\t\t\t\tid: comp.id,\n\t\t\t});\n\t\t\tconst internalOrder = nextInternalOrderRef.current++;\n\t\t\tinternalOrderRef.current.set(orderKey, internalOrder);\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 [\n\t\t\t\t\t...comps,\n\t\t\t\t\t{\n\t\t\t\t\t\t...comp,\n\t\t\t\t\t\torder: committedOrderRef.current?.get(orderKey) ?? internalOrder,\n\t\t\t\t\t},\n\t\t\t\t] as AnyComposition[];\n\t\t\t});\n\t\t},\n\t\t[updateCompositions],\n\t);\n\n\tconst unregisterComposition = useCallback((id: string) => {\n\t\tinternalOrderRef.current.delete(","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/remotion-dev/remotion/blob/a6a7485a9aeb04219510fbe4874f8941486424df/packages/core/src/CompositionManagerProvider.tsx#L84-L120","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":"a6a7485a9aeb04219510fbe4874f8941486424df","analyzedAt":"2026-09-02T16:25:19.997Z","contentChangedAt":"2026-09-02T16:25:19.997Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}