{"record":{"id":"371d2201fd0a11c0","repo":"remotion-dev/remotion","slug":"cannot-reorder-effect-source-effect-is-not-call-expression","errorCode":null,"errorMessage":"Cannot reorder effect: source effect is not-call-expression","messagePattern":"Cannot reorder effect: source effect is not-call-expression","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/studio-codemods/src/effect-operations.ts","lineNumber":605,"sourceCode":"\t\tconst jsx = getJsx({action: 'reorder', ast, sequenceNodePath});\n\t\tconst attr = findEffectsAttr(jsx.attributes);\n\t\tif (!attr) {\n\t\t\tthrow new Error('Could not find effects on the target JSX element');\n\t\t}\n\n\t\tconst array = getEffectsArray(attr, 'reorder');\n\t\tconst elements = enumerateEffectArrayElements(array);\n\t\tif (fromIndex < 0 || fromIndex >= elements.length) {\n\t\t\tthrow new Error('Cannot reorder effect: source index not-found');\n\t\t}\n\n\t\tif (toIndex < 0 || toIndex >= elements.length) {\n\t\t\tthrow new Error('Cannot reorder effect: target index not-found');\n\t\t}\n\n\t\tconst target = elements[fromIndex];\n\t\tif (target.kind !== 'call') {\n\t\t\tthrow new Error(\n\t\t\t\t'Cannot reorder effect: source effect is not-call-expression',\n\t\t\t);\n\t\t}\n\n\t\ttrackOpeningElement({jsx, snapshots});\n\t\tif (fromIndex !== toIndex) {\n\t\t\tconst [moved] = array.elements.splice(fromIndex, 1);\n\t\t\tarray.elements.splice(toIndex, 0, moved as never);\n\t\t}\n\n\t\treturn {\n\t\t\toutput: getEffectSourceOutput({\n\t\t\t\tast,\n\t\t\t\tinput,\n\t\t\t\tprettierConfigOverride: prettierConfigOverride ?? null,\n\t\t\t\tsnapshots,\n\t\t\t}),\n\t\t\tformatted: true,","sourceCodeStart":587,"sourceCodeEnd":623,"githubUrl":"https://github.com/remotion-dev/remotion/blob/46a3a6bf13ca367376ff18bbb06dae2e87e0d068/packages/studio-codemods/src/effect-operations.ts#L587-L623","documentation":"reorderEffect() only supports moving entries of the effects array that are plain call expressions like <FadeIn/> style effects={[(interpolate(...), Spring())]}. If the element at fromIndex is a spread element, hole, or any other non-call node, it throws this error. The reorder operation cannot represent such entries safely when moving them.","triggerScenarios":"Calling reorderEffect({fromIndex, ...}) where the effects array at that index contains something other than a call expression — e.g. effects={[...(someArray), Spring()]} and fromIndex points at the spread element, or an array hole from sparse literals.","commonSituations":"Hand-edited JSX where a developer spread an array into effects; generated code that included spreads; sparse arrays; UI showing all indices as draggable including non-call entries.","solutions":["Choose a fromIndex that points at an actual effect call (e.g. the Spring() or interpolate() entry).","Rewrite the source so spread elements are flattened into explicit calls before reordering.","Check enumerateEffectArrayElements output/kind in your tooling to skip non-call entries in the UI."],"exampleFix":"// before\n<Sequence effects={[...extraEffects, Spring()]} /> // reorderEffect fromIndex: 0 hits the spread\n// after\n<Sequence effects={[FadeIn(), Spring()]} /> // reorderEffect fromIndex: 0 hits FadeIn()","handlingStrategy":"type-guard","validationCode":"const elements = enumerateEffectArrayElements(getEffectsArray(attr));\nif (elements[fromIndex].kind !== 'call') {\n  throw new TypeError('Source effect is not a call expression');\n}","typeGuard":"const isCallElement = (\n  el: EffectArrayElement,\n): el is Extract<EffectArrayElement, {kind: 'call'}> => el.kind === 'call';","tryCatchPattern":"try {\n  await reorderEffect({input, fromIndex, toIndex, sequenceNodePath});\n} catch (e) {\n  if (e instanceof Error && e.message.includes('not-call-expression')) {\n    // disable reorder UI for this row or flatten spreads first\n  } else throw e;\n}","preventionTips":["Keep effects arrays literal: flatten spreads and avoid holes.","Only expose reorder controls for rows whose element kind is 'call'."],"tags":["ast","unsupported-operation","studio"],"backgroundTag":"unsupported-operation","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"}