remotion-dev/remotion · error
New composition source does not match installation target
Error message
New composition source does not match installation target
What it means
After resolving the registration file for the new composition, the route compares it (resolved to an absolute path) with the compositionFile targeted by the request. If they differ, the new composition would be written to a file other than the requested installation target, so the route refuses to proceed.
Solutions
- Pass compositionFile as the exact file where the new composition will be registered
- Regenerate the plan so symbolicatedStack and compositionFile agree
- Remove duplicate Root registrations so resolution is unambiguous
Example fix
// before compositionFile = 'src/OtherRoot.tsx'; // codemod registers in src/Root.tsx // after compositionFile = 'src/Root.tsx';
Defensive patterns
Strategy: validation
Validate before calling
const resolved = path.resolve(remotionRoot, compositionFile);
if (registrationFilePath && resolved !== registrationFilePath) {
throw new Error('compositionFile must be the file registering the new composition');
} Try / catch
try {
await insertElement(payload);
} catch (e) {
if (/source does not match installation target/.test(e.message)) {
payload.compositionFile = registrationFilePath; // use the resolved file
}
} Prevention
- Pass compositionFile as the same file the codemod/symbolicated stack resolves to
- Avoid multiple Root registration files for one project
- Use absolute, symlink-free paths in requests
When it happens
Trigger: POSTing to insert-element with newComposition whose resolved registration file is not the same file as the request's compositionFile — e.g. the codemod resolves to a different Root file than the one the request targeted.
Common situations: Multiple Root files in a project, stale symbolicated stack pointing at an old registration file, or compositionFile given as a path that resolves differently (relative vs absolute, symlinked directories).
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- New composition component does not match installation target
- Component-owned Element initial props must not override…
- Component-owned Element initial style must be an object
- New composition ID does not match installation target
- A custom role ARN must either be "undefined" or a string…
AI-assisted analysis of remotion-dev/remotion@46a3a6bf13 (2026-09-18).
Data as JSON: /api/errors/3e468e5037f42dff.
Report an issue: GitHub.
Appendix: source
Thrown at packages/studio-server/src/preview-server/routes/insert-element.ts:152
'New composition ID does not match installation target',
);
}
const registrationFilePath = newComposition.symbolicatedStack
? resolveFilePathFromSymbolicatedStack(
remotionRoot,
newComposition.symbolicatedStack,
)
: (await getProjectInfo(remotionRoot, entryPoint)).rootFile;
if (registrationFilePath === null) {
throw new Error('Cannot find file for composition in project');
}
checkIfTypeScriptFile(registrationFilePath);
if (
path.resolve(remotionRoot, compositionFile) !== registrationFilePath
) {
throw new Error(
'New composition source does not match installation target',
);
}
const componentFilePath = path.join(
path.dirname(registrationFilePath),
`${newComposition.codemod.componentName}.tsx`,
);
if (existsSync(componentFilePath)) {
throw new Error(
`Cannot create ${path.relative(
remotionRoot,
componentFilePath,
)} because it already exists`,
);
}
const registrationFileOldContents = readFileSync(View on GitHub (pinned to 46a3a6bf13)