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

The codemod for a new composition must target the same source file as the request's compositionFile installation target. resolveCodemodTargetFile derives the file from the codemod plus symbolicated stack; if it differs from request.compositionFile, the request is internally inconsistent and would write the new composition into the wrong file, so the operation throws.

Solutions

  1. Update request.compositionFile to match the file the codemod resolves to.
  2. Fix the codemod or symbolicatedStack so the target resolves to the intended file.
  3. Recreate the request after the file was moved or renamed.

Example fix

// before
{compositionFile: '/src/Root.tsx', codemod: {...targeting /src/Root2.tsx}}
// after
{compositionFile: '/src/Root2.tsx', codemod: {...targeting /src/Root2.tsx}}
Defensive patterns

Strategy: validation

Validate before calling

const resolved = resolveCodemodTargetFile({codemod, project, symbolicatedStack});
if (resolved !== compositionFile) throw new Error('codemod target mismatch');

Try / catch

try {
  await applyOperation(request);
} catch (e) {
  if (String(e).includes('source does not match')) refreshRequestFromProject();
}

Prevention

When it happens

Trigger: request.newComposition is non-null and the resolved absolute codemod target path !== request.compositionFile.

Common situations: Symbolicated stack pointing at a moved/renamed file; requests assembled from stale project state; monorepo aliases resolving to a different path form than the UI recorded.

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/4d97b4a357feaca0. Report an issue: GitHub.

Appendix: source

Thrown at packages/browser-studio/src/browser-studio-operations.ts:2056

					);
				}

				const originalProject = getProject();
				let project = originalProject;
				if (request.newComposition !== null) {
					if (request.newComposition.codemod.newId !== request.compositionId) {
						throw new Error(
							'New composition ID does not match installation target',
						);
					}

					const absolutePath = resolveCodemodTargetFile({
						codemod: request.newComposition.codemod,
						project,
						symbolicatedStack: request.newComposition.symbolicatedStack,
					});
					if (absolutePath !== request.compositionFile) {
						throw new Error(
							'New composition source does not match installation target',
						);
					}

					const input = project.files[absolutePath];
					const {newContents} = parseAndApplyCodemod({
						input,
						codeMod: request.newComposition.codemod,
					});
					const componentFilePath = `${dirname(absolutePath)}/${request.newComposition.codemod.componentName}.tsx`;
					if (project.files[componentFilePath] !== undefined) {
						throw new Error(
							`Cannot create ${relativeToRoot(componentFilePath, project.rootDir)} because it already exists`,
						);
					}

					project = {
						...project,

View on GitHub (pinned to 46a3a6bf13)