remotion-dev/remotion · error

Could not find folder "${folderPath}"

Error message

Could not find folder "${folderPath}"

What it means

moveCompositionOrFolder supports moving a composition or folder into a destination folder. When destination.type is 'folder', the AST walk searches for a folder JSX wrapper whose name and parentFolderName match the requested destination. If no such folder element exists in the file, this error is thrown with the fully qualified folder path.

Source

Thrown at packages/studio-codemods/src/recast-mods.ts:665

			transformation.destination.type === 'after') &&
		target === null
	) {
		throw new Error(
			`Could not find ${getCompositionOrFolderLabel(transformation.destination.target)} as a reorder target`,
		);
	}

	if (
		transformation.destination.type === 'folder' &&
		destinationFolder === null
	) {
		const folderPath = [
			transformation.destination.parentName,
			transformation.destination.folderName,
		]
			.filter(Boolean)
			.join('/');
		throw new Error(`Could not find folder "${folderPath}"`);
	}

	if (target !== null && (target as LocatedItem).node === sourceItem.node) {
		return {newAst: file, changesMade};
	}

	const sourceFolderPath =
		transformation.source.type === 'folder'
			? [transformation.source.parentName, transformation.source.folderName]
					.filter(Boolean)
					.join('/')
			: null;
	const destinationParentFolderName =
		transformation.destination.type === 'root'
			? null
			: transformation.destination.type === 'folder'
				? [
						transformation.destination.parentName,

View on GitHub (pinned to a6a7485a9a)

Solutions

  1. Ensure the destination folder (a <Folder name="..."> element) exists in the composition file with exactly matching parentName and folderName
  2. Regenerate the transformation from freshly read studio/composition state
  3. Create the destination folder first, or move to destination {type: 'root'} as a fallback

Example fix

// before
destination: {type: 'folder', parentName: 'OldParent', folderName: 'MyFolder'}
// after
// match the actual folder layout
destination: {type: 'folder', parentName: 'NewParent', folderName: 'MyFolder'}
Defensive patterns

Strategy: validation

Validate before calling

const folderExists = findFolderElement(ast, destination.parentName, destination.folderName);
if (!folderExists) throw new Error(`Destination folder "${[destination.parentName, destination.folderName].filter(Boolean).join('/')}" does not exist`);

Type guard

const isFolderDestination = (d: Destination) => d.type === 'folder' && Boolean(d.folderName);

Try / catch

try {
  await applyCodemod({transformation});
} catch (e) {
  if (String(e).startsWith('Could not find folder')) {
    // create the folder or move to root
  } else throw e;
}

Prevention

When it happens

Trigger: Calling applyCodemod with destination {type: 'folder', parentName, folderName} where no <Folder name={folderName}> element with that parent exists as a direct JSX child in the composition file — the destination folder was deleted, renamed, or is in another file.

Common situations: Stale folder state after refactoring the composition layout; typo in parentName/folderName; destination folder only exists in a different composition file; script written against an older project structure.

Related errors


AI-assisted analysis of remotion-dev/remotion@a6a7485a9a (2026-09-02). Data as JSON: /api/errors/2616a06ffb99fb6e. Report an issue: GitHub.