{"record":{"id":"29eb48a012f04528","repo":"remotion-dev/remotion","slug":"new-composition-id-does-not-match-installation-target-insert","errorCode":null,"errorMessage":"New composition ID does not match installation target","messagePattern":"New composition ID does not match installation target","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/studio-server/src/preview-server/routes/insert-element.ts","lineNumber":133,"sourceCode":"\t\t\t}\n\n\t\t\tRenderInternals.Log.trace(\n\t\t\t\t{indent: false, logLevel},\n\t\t\t\t`[insert-element] Received request for compositionFile=\"${compositionFile}\" compositionId=\"${compositionId}\" element=\"${element.slug}\"`,\n\t\t\t);\n\n\t\t\tlet compositionCreation: {\n\t\t\t\tcomponentFilePath: string;\n\t\t\t\tcomponentFileContents: string;\n\t\t\t\tregistrationFilePath: string;\n\t\t\t\tregistrationFileOldContents: string;\n\t\t\t\tregistrationFileNewContents: string;\n\t\t\t} | null = null;\n\t\t\tlet sourceFileOverrides: ReadonlyMap<string, string> | null = null;\n\n\t\t\tif (newComposition !== null) {\n\t\t\t\tif (newComposition.codemod.newId !== compositionId) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t'New composition ID does not match installation target',\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst registrationFilePath = newComposition.symbolicatedStack\n\t\t\t\t\t? resolveFilePathFromSymbolicatedStack(\n\t\t\t\t\t\t\tremotionRoot,\n\t\t\t\t\t\t\tnewComposition.symbolicatedStack,\n\t\t\t\t\t\t)\n\t\t\t\t\t: (await getProjectInfo(remotionRoot, entryPoint)).rootFile;\n\t\t\t\tif (registrationFilePath === null) {\n\t\t\t\t\tthrow new Error('Cannot find file for composition in project');\n\t\t\t\t}\n\n\t\t\t\tcheckIfTypeScriptFile(registrationFilePath);\n\t\t\t\tif (\n\t\t\t\t\tpath.resolve(remotionRoot, compositionFile) !== registrationFilePath\n\t\t\t\t) {","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/remotion-dev/remotion/blob/46a3a6bf13ca367376ff18bbb06dae2e87e0d068/packages/studio-server/src/preview-server/routes/insert-element.ts#L115-L151","documentation":"When an insert-element request triggers creation of a new composition, the request carries the target compositionId, and the generated codemod carries newId. The route asserts these match before proceeding; a mismatch means the request payload is internally inconsistent (the codemod would register the composition under a different ID than the one being targeted).","triggerScenarios":"POSTing to insert-element with newComposition whose codemod.newId differs from the request's compositionId — e.g. the codemod plan was generated for a different installation name or the payload was hand-edited.","commonSituations":"Manually constructing or modifying the insert request, or reusing a cached newComposition plan after renaming the installation.","solutions":["Regenerate the request so codemod.newId and compositionId come from the same plan","Ensure the installationName/compositionId was not renamed between plan generation and insertion","Do not hand-edit newComposition in the request payload"],"exampleFix":"// before\nnewComposition.codemod.newId = 'MyComp-v2'; compositionId = 'MyComp';\n// after\nnewComposition.codemod.newId = 'MyComp'; compositionId = 'MyComp';","handlingStrategy":"validation","validationCode":"if (newComposition && newComposition.codemod.newId !== compositionId) {\n  throw new Error('regenerate the plan: newId does not match compositionId');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await insertElement(payload);\n} catch (e) {\n  if (/does not match installation target/.test(e.message) && /ID/.test(e.message)) {\n    payload = regenerateInsertPayload(installationName); // rebuild newComposition\n  }\n}","preventionTips":["Always generate newComposition and compositionId from the same plan call","Never hand-edit newComposition fields","Regenerate the plan if the installation name changes"],"tags":["validation","insert-element","composition-id"],"backgroundTag":"invalid-argument-value","analyzedSha":"46a3a6bf13ca367376ff18bbb06dae2e87e0d068","analyzedAt":"2026-09-18T00:12:20.256Z","contentChangedAt":"2026-09-18T00:12:20.256Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}