remotion-dev/remotion · error · Error

New composition ID does not match installation target

Error message

New composition ID does not match installation target

What it means

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).

Solutions

  1. Regenerate the request so codemod.newId and compositionId come from the same plan
  2. Ensure the installationName/compositionId was not renamed between plan generation and insertion
  3. Do not hand-edit newComposition in the request payload

Example fix

// before
newComposition.codemod.newId = 'MyComp-v2'; compositionId = 'MyComp';
// after
newComposition.codemod.newId = 'MyComp'; compositionId = 'MyComp';
Defensive patterns

Strategy: validation

Validate before calling

if (newComposition && newComposition.codemod.newId !== compositionId) {
  throw new Error('regenerate the plan: newId does not match compositionId');
}

Try / catch

try {
  await insertElement(payload);
} catch (e) {
  if (/does not match installation target/.test(e.message) && /ID/.test(e.message)) {
    payload = regenerateInsertPayload(installationName); // rebuild newComposition
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: Manually constructing or modifying the insert request, or reusing a cached newComposition plan after renaming the installation.

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/29eb48a012f04528. Report an issue: GitHub.

Appendix: source

Thrown at packages/studio-server/src/preview-server/routes/insert-element.ts:133

			}

			RenderInternals.Log.trace(
				{indent: false, logLevel},
				`[insert-element] Received request for compositionFile="${compositionFile}" compositionId="${compositionId}" element="${element.slug}"`,
			);

			let compositionCreation: {
				componentFilePath: string;
				componentFileContents: string;
				registrationFilePath: string;
				registrationFileOldContents: string;
				registrationFileNewContents: string;
			} | null = null;
			let sourceFileOverrides: ReadonlyMap<string, string> | null = null;

			if (newComposition !== null) {
				if (newComposition.codemod.newId !== compositionId) {
					throw new Error(
						'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
				) {

View on GitHub (pinned to 46a3a6bf13)