remotion-dev/remotion · error · Error

Unable to calculate the changes needed for this file. Edit…

Error message

Unable to calculate the changes needed for this file. Edit the file manually.

What it means

Thrown by editFolderInSource (folder-source-edits.ts:487) when applyCodemod completed but reported zero changes. The high-level AST transform (e.g. add/remove folder entries in the schema) did not actually alter the AST, so generating source edits would produce an unchanged file — Remotion surfaces a generic 'edit the file manually' message instead of silently doing nothing.

Solutions

  1. Reload the Studio so its internal state re-syncs with the Root file, then retry the action
  2. Check whether the change already exists in the file (duplicate create/rename to the same name is a no-op)
  3. Edit the Root file manually as the message suggests — wrap/unwrap the <Folder> or rename the name attribute by hand
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-check the mutation would change something
if (folderAlreadyExists(input, codeMod) || folderAlreadyAbsent(input, codeMod)) {
  return; // no-op; skip codemod entirely
}

Try / catch

try {
  const {newContents, changesMade} = editFolderInSource({codeMod, input});
} catch (e) {
  if (e instanceof Error && e.message.startsWith('Unable to calculate the changes needed')) {
    // treat as no-op; reload Studio state or edit the file manually
  }
}

Prevention

When it happens

Trigger: Any FolderCodemod (new-folder, rename-folder, delete-folder, move-*) whose mutation is a no-op: the folder already exists with the requested shape, the rename yields the same name, the entry to delete is already absent, or the codemod data is out of sync with the file's AST.

Common situations: Clicking a Studio action twice so the second identical codemod finds nothing to change; the Root file was edited externally so the codemod's expected structure no longer exists; schema/state mismatch after hot reload.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at packages/studio-codemods/src/folder-source-edits.ts:487

	codeMod,
	input,
}: {
	codeMod: FolderCodemod;
	input: string;
}): {changesMade: Change[]; newContents: string} => {
	const ast = parseAst(input);
	const items = getLocatedItems(ast);
	const folder =
		codeMod.type === 'rename-folder' || codeMod.type === 'delete-folder'
			? getFolder({
					folderName: codeMod.folderName,
					items,
					parentName: codeMod.parentName,
				})
			: null;
	const {newAst, changesMade} = applyCodemod({file: ast, codeMod});
	if (changesMade.length === 0) {
		throw new Error(
			'Unable to calculate the changes needed for this file. Edit the file manually.',
		);
	}

	let edits: SourceEdit[];
	if (codeMod.type === 'new-folder') {
		edits = getNewFolderSourceEdits({ast: newAst, input});
	} else if (codeMod.type === 'rename-folder') {
		if (folder === null) {
			throw new Error('Could not locate the folder to rename');
		}

		edits = [
			getJsxStringAttributeValueSourceEdit({
				attribute: getFolderNameAttribute(folder.node),
				input,
				newValue: codeMod.newName,
			}),

View on GitHub (pinned to 46a3a6bf13)