remotion-dev/remotion · error

Could not find effects on the target JSX element

Error message

Could not find effects on the target JSX element

What it means

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.

Solutions

  1. Add an `effects={[...]}` prop to the target JSX element before duplicating its effects
  2. Re-resolve the sequenceNodePath against the current file contents before calling
  3. Confirm the targeted element is the one actually carrying the effects prop
  4. Use addEffect instead if you intend to introduce the first effect

Example fix

// before
<Sequence name="s">...</Sequence>
// after
<Sequence name="s" effects={[LightLeak({})]}>...</Sequence>
Defensive patterns

Strategy: type-guard

Validate before calling

const jsx = findJsxElementAtNodePath(parseAst(input), sequenceNodePath);
if (!jsx || !findEffectsAttr(jsx.attributes)) throw new Error('element has no effects prop');

Type guard

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');

Try / catch

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; }

Prevention

When it happens

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

Common situations: 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.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of remotion-dev/remotion@46a3a6bf13 (2026-09-18). Data as JSON: /api/errors/7e27078310acb30c. Report an issue: GitHub.

Appendix: source

Thrown at packages/studio-codemods/src/effect-operations.ts:481

			throw new Error('No effects were specified for duplication');
		}

		const ast = parseAst(input);
		const snapshots = captureEffectSourceSnapshots(ast);
		const effectsByAttribute = new Map<
			JSXAttribute,
			{
				array: ArrayExpression;
				indices: Set<number>;
				effectLabels: string[];
				logLines: number[];
			}
		>();
		for (const {effectIndex, sequenceNodePath} of effects) {
			const jsx = getJsx({action: 'duplicate', ast, sequenceNodePath});
			const attr = findEffectsAttr(jsx.attributes);
			if (!attr) {
				throw new Error('Could not find effects on the target JSX element');
			}

			const array = getEffectsArray(attr, 'duplicate');
			const found = findEffectCallExpression({attr, effectIndex});
			if (found.kind === 'error') {
				throw new Error(`Cannot duplicate effect: ${found.reason}`);
			}

			const group = effectsByAttribute.get(attr) ?? {
				array,
				indices: new Set<number>(),
				effectLabels: [],
				logLines: [],
			};
			effectsByAttribute.set(attr, group);
			trackOpeningElement({jsx, snapshots});
			if (group.indices.has(effectIndex)) {
				continue;

View on GitHub (pinned to 46a3a6bf13)