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.
Source
Thrown at packages/browser-studio/src/browser-studio-operations.ts:1385
...project,
files: {
...project.files,
...Object.fromEntries(
updates.map(({fileName, result}) => [fileName, result.output]),
),
},
};
const nodePathMutation = controller.applyMutation({
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 b2f4e34732)
Solutions
- Confirm the nodePath exists in the current file source before duplicating.
- Track 'sequence-node-paths-remapped' events and update stored node paths.
- 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
- Keep node paths fresh by consuming remap events after every mutation.
- Refresh duplicated-path references after any undo/redo.
- Always inspect the structured result; do not assume success.
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
- Could not delete JSX nodes
- Could not split JSX sequence
- Could not find a root JSX element
- Could not find ${getCompositionOrFolderLabel(transformation.
- Could not find composition "${compositionId}"
AI-assisted analysis of remotion-dev/remotion@b2f4e34732 (2026-08-28).
Data as JSON: /api/errors/f4c36770353b3198.
Report an issue: GitHub.