{"record":{"id":"dfad9dcd540c93c7","repo":"remotion-dev/remotion","slug":"cannot-delete-effect-no-effects-found","errorCode":null,"errorMessage":"Cannot delete effect: no effects found","messagePattern":"Cannot delete effect: no effects found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/studio-codemods/src/effect-operations.ts","lineNumber":683,"sourceCode":"\t\t\t});\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 group = effectsByAttribute.get(attr) ?? {\n\t\t\t\tall: false,\n\t\t\t\tarray: getEffectsArray(attr, 'delete'),\n\t\t\t\tattributes: jsx.attributes,\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 (effect.type === 'all-effects') {\n\t\t\t\tif (group.array.elements.length === 0) {\n\t\t\t\t\tthrow new Error('Cannot delete effect: no effects found');\n\t\t\t\t}\n\n\t\t\t\tconst elements = enumerateEffectArrayElements(group.array);\n\t\t\t\tgroup.all = true;\n\t\t\t\tgroup.indices.clear();\n\t\t\t\tgroup.effectLabels = elements.map((element) =>\n\t\t\t\t\telement.kind === 'call' ? `${element.callee}()` : 'effect',\n\t\t\t\t);\n\t\t\t\tgroup.logLines = elements.map((element) =>\n\t\t\t\t\telement.kind === 'call'\n\t\t\t\t\t\t? (element.node.loc?.start.line ?? attr.loc?.start.line ?? 1)\n\t\t\t\t\t\t: (attr.loc?.start.line ?? 1),\n\t\t\t\t);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (group.all || group.indices.has(effect.effectIndex)) {\n\t\t\t\tcontinue;","sourceCodeStart":665,"sourceCodeEnd":701,"githubUrl":"https://github.com/remotion-dev/remotion/blob/46a3a6bf13ca367376ff18bbb06dae2e87e0d068/packages/studio-codemods/src/effect-operations.ts#L665-L701","documentation":"When a deletion target has type 'all-effects', deleteEffects() inspects the resolved effects array and requires at least one element. If the effects={[]} array is empty there is nothing to delete, so it throws this error. This catches attempts to clear an already-empty effects list.","triggerScenarios":"deleteEffects({effects: [{type: 'all-effects', sequenceNodePath}]}) where the element's effects array is empty, i.e. effects={[]} — commonly because a previous operation already deleted all effects.","commonSituations":"Double-invoking a 'delete all effects' action; UI not refreshing the effect count after a prior delete-all; element authored with an empty effects array placeholder.","solutions":["Check the effects array has entries (e.g. via the interactivity schema/effect list) before requesting an all-effects delete.","Treat this as a no-op in your UI: if the count is 0, skip the call.","Re-read the source after each mutation so counts are current."],"exampleFix":"// before\nawait deleteEffects({input, effects: [{type: 'all-effects', sequenceNodePath}]});\n// after\nif (countEffects(input, sequenceNodePath) > 0) {\n  await deleteEffects({input, effects: [{type: 'all-effects', sequenceNodePath}]});\n}","handlingStrategy":"validation","validationCode":"const count = enumerateEffects(input, sequenceNodePath).length;\nif (count === 0) return input; // already empty\nawait deleteEffects({input, effects: [{type: 'all-effects', sequenceNodePath}]});","typeGuard":null,"tryCatchPattern":"try {\n  await deleteEffects({input, effects});\n} catch (e) {\n  if (e instanceof Error && e.message === 'Cannot delete effect: no effects found') return input;\n  throw e;\n}","preventionTips":["Refresh effect counts after each codemod before issuing delete-all.","Treat deleting an already-empty effects list as a no-op in UI logic."],"tags":["empty-result","ast","studio"],"backgroundTag":"empty-result-set","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"}