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

  1. Pass compositionFile as the exact file where the new composition will be registered
  2. Regenerate the plan so symbolicatedStack and compositionFile agree
  3. 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

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


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)