remotion-dev/remotion · error · Error

Could not duplicate JSX node

Error message

Could not duplicate JSX node

What it means

duplicateJsxNode commits its duplication through controller.applyMutation; a null return (mutation produced no project change / no node-path mutation could be reported) is treated as failure and throws 'Could not duplicate JSX node', returned to the caller via getStructuredError.

Solutions

  1. Confirm the nodePath exists in the current file source before duplicating.
  2. Track 'sequence-node-paths-remapped' events and update stored node paths.
  3. If reproducible with a valid path, capture file contents and path and report it as a bug.
Defensive patterns

Strategy: validation

Validate before calling

const file = project.files[fileName] ?? '';
if (file.length === 0) {
  // file missing or path stale — resolve the file before duplicating
}

Try / catch

const result = await operations.duplicateJsxNode({fileName, nodePath});
if (!result.success && result.reason === 'Could not duplicate JSX node') {
  // refresh nodePath from the latest 'sequence-node-paths-remapped' event and retry once
}

Prevention

When it happens

Trigger: Duplicating a node whose nodePath no longer resolves in the file (stale path after edits), so the codemod result commits as a no-op and applyMutation returns null.

Common situations: Duplicate actions fired from stale timeline state after the target was renamed, wrapped, or undone; agent pipelines replaying recorded node paths against a modified project.

Related errors


AI-assisted analysis of remotion-dev/remotion@46a3a6bf13 (2026-08-28). Data as JSON: /api/errors/f4c36770353b3198. Report an issue: GitHub.

Appendix: source

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

				files: {
					...project.files,
					...Object.fromEntries(
						updates.map(({fileName, result}) => [fileName, result.output]),
					),
				},
			};
			const nodePathMutation = controller.applyMutation({
				undoRedoNavigation: null,
				timelineSelection: null,
				fileName: updates.map(({fileName}) => fileName).join(', '),
				mutate: () => nextProject,
				nodePathMutationFiles: updates.map(({fileName, result}) => ({
					absolutePath: fileName,
					remappings: result.nodePathRemappings,
				})),
			});
			if (nodePathMutation === null) {
				throw new Error('Could not duplicate JSX node');
			}

			return {success: true, nodePathMutation};
		} catch (error) {
			return getStructuredError(error);
		}
	};

	const splitJsxSequence: BrowserStudioOperations['splitJsxSequence'] = async ({
		fileName,
		nodePath,
		sequenceKeys,
		splitFrame,
	}) => {
		try {
			const project = getProject();
			const absolutePath = findProjectFile({
				filePath: fileName,

View on GitHub (pinned to 46a3a6bf13)