{"record":{"id":"7e27078310acb30c","repo":"remotion-dev/remotion","slug":"could-not-find-effects-on-the-target-jsx-element","errorCode":null,"errorMessage":"Could not find effects on the target JSX element","messagePattern":"Could not find effects on the target JSX element","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/studio-codemods/src/effect-operations.ts","lineNumber":481,"sourceCode":"\t\t\tthrow new Error('No effects were specified for duplication');\n\t\t}\n\n\t\tconst ast = parseAst(input);\n\t\tconst snapshots = captureEffectSourceSnapshots(ast);\n\t\tconst effectsByAttribute = new Map<\n\t\t\tJSXAttribute,\n\t\t\t{\n\t\t\t\tarray: ArrayExpression;\n\t\t\t\tindices: Set<number>;\n\t\t\t\teffectLabels: string[];\n\t\t\t\tlogLines: number[];\n\t\t\t}\n\t\t>();\n\t\tfor (const {effectIndex, sequenceNodePath} of effects) {\n\t\t\tconst jsx = getJsx({action: 'duplicate', ast, sequenceNodePath});\n\t\t\tconst attr = findEffectsAttr(jsx.attributes);\n\t\t\tif (!attr) {\n\t\t\t\tthrow new Error('Could not find effects on the target JSX element');\n\t\t\t}\n\n\t\t\tconst array = getEffectsArray(attr, 'duplicate');\n\t\t\tconst found = findEffectCallExpression({attr, effectIndex});\n\t\t\tif (found.kind === 'error') {\n\t\t\t\tthrow new Error(`Cannot duplicate effect: ${found.reason}`);\n\t\t\t}\n\n\t\t\tconst group = effectsByAttribute.get(attr) ?? {\n\t\t\t\tarray,\n\t\t\t\tindices: new Set<number>(),\n\t\t\t\teffectLabels: [],\n\t\t\t\tlogLines: [],\n\t\t\t};\n\t\t\teffectsByAttribute.set(attr, group);\n\t\t\ttrackOpeningElement({jsx, snapshots});\n\t\t\tif (group.indices.has(effectIndex)) {\n\t\t\t\tcontinue;","sourceCodeStart":463,"sourceCodeEnd":499,"githubUrl":"https://github.com/remotion-dev/remotion/blob/46a3a6bf13ca367376ff18bbb06dae2e87e0d068/packages/studio-codemods/src/effect-operations.ts#L463-L499","documentation":"duplicateEffects locates the `effects={...}` prop on the JSX element resolved from each effect's sequenceNodePath. If the element has no effects attribute at all there is no array to clone the effect into, so it throws. This mirrors the same check in reorderEffect and deleteEffects.","triggerScenarios":"Calling duplicateEffects/duplicateEffect with a sequenceNodePath pointing at a JSX element that has no `effects` attribute; passing a stale effectIndex/nodePath pair after the source was edited and the effects prop removed.","commonSituations":"Source edited externally (manual edit or another codemod) between reading the element tree and duplicating; targeting the wrong Sequence element; a composition written before effects were added.","solutions":["Add an `effects={[...]}` prop to the target JSX element before duplicating its effects","Re-resolve the sequenceNodePath against the current file contents before calling","Confirm the targeted element is the one actually carrying the effects prop","Use addEffect instead if you intend to introduce the first effect"],"exampleFix":"// before\n<Sequence name=\"s\">...</Sequence>\n// after\n<Sequence name=\"s\" effects={[LightLeak({})]}>...</Sequence>","handlingStrategy":"type-guard","validationCode":"const jsx = findJsxElementAtNodePath(parseAst(input), sequenceNodePath);\nif (!jsx || !findEffectsAttr(jsx.attributes)) throw new Error('element has no effects prop');","typeGuard":"const hasEffectsAttr = (el: JSXElement | null): el is JSXElement => !!el && el.openingElement.attributes.some((a) => a.type === 'JSXAttribute' && a.name.type === 'JSXIdentifier' && a.name.name === 'effects');","tryCatchPattern":"try { await duplicateEffect({effectIndex, input, sequenceNodePath}); } catch (e) { if ((e as Error).message.includes('Could not find effects')) { /* fall back to addEffect */ } else throw e; }","preventionTips":["Verify the target element carries an effects prop before effect operations","Re-read source and re-resolve nodePaths after any external edit","Use addEffect to introduce the first effect on a bare element"],"tags":["jsx","effects","resource-not-found"],"backgroundTag":"record-not-found","analyzedSha":"46a3a6bf13ca367376ff18bbb06dae2e87e0d068","analyzedAt":"2026-09-18T00:12:20.256Z","contentChangedAt":"2026-09-18T00:12:20.256Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}