{"record":{"id":"f4c36770353b3198","repo":"remotion-dev/remotion","slug":"could-not-duplicate-jsx-node","errorCode":null,"errorMessage":"Could not duplicate JSX node","messagePattern":"Could not duplicate JSX node","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/browser-studio/src/browser-studio-operations.ts","lineNumber":1385,"sourceCode":"\t\t\t\t...project,\n\t\t\t\tfiles: {\n\t\t\t\t\t...project.files,\n\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\tupdates.map(({fileName, result}) => [fileName, result.output]),\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t};\n\t\t\tconst nodePathMutation = controller.applyMutation({\n\t\t\t\ttimelineSelection: null,\n\t\t\t\tfileName: updates.map(({fileName}) => fileName).join(', '),\n\t\t\t\tmutate: () => nextProject,\n\t\t\t\tnodePathMutationFiles: updates.map(({fileName, result}) => ({\n\t\t\t\t\tabsolutePath: fileName,\n\t\t\t\t\tremappings: result.nodePathRemappings,\n\t\t\t\t})),\n\t\t\t});\n\t\t\tif (nodePathMutation === null) {\n\t\t\t\tthrow new Error('Could not duplicate JSX node');\n\t\t\t}\n\n\t\t\treturn {success: true, nodePathMutation};\n\t\t} catch (error) {\n\t\t\treturn getStructuredError(error);\n\t\t}\n\t};\n\n\tconst splitJsxSequence: BrowserStudioOperations['splitJsxSequence'] = async ({\n\t\tfileName,\n\t\tnodePath,\n\t\tsequenceKeys,\n\t\tsplitFrame,\n\t}) => {\n\t\ttry {\n\t\t\tconst project = getProject();\n\t\t\tconst absolutePath = findProjectFile({\n\t\t\t\tfilePath: fileName,","sourceCodeStart":1367,"sourceCodeEnd":1403,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/browser-studio/src/browser-studio-operations.ts#L1367-L1403","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const file = project.files[fileName] ?? '';\nif (file.length === 0) {\n  // file missing or path stale — resolve the file before duplicating\n}","typeGuard":null,"tryCatchPattern":"const result = await operations.duplicateJsxNode({fileName, nodePath});\nif (!result.success && result.reason === 'Could not duplicate JSX node') {\n  // refresh nodePath from the latest 'sequence-node-paths-remapped' event and retry once\n}","preventionTips":["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."],"tags":["jsx","codemod","node-path","stale-state"],"backgroundTag":"no-op-mutation-rejected","analyzedSha":"b2f4e34732f3c6c222ea029413e22dc402218cd7","analyzedAt":"2026-08-28T15:39:09.316Z","contentChangedAt":"2026-08-28T15:39:09.316Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}