remotion-dev/remotion · error
A folder named " " already exists in the destination
Error message
A folder named "${sourceFolderName}" already exists in the destination What it means
When moving a folder to a destination parent, the codemod checks the destination for a different folder element with the same folder name. If such a sibling folder already exists there (excluding the source folder itself), the move would produce two folders with the same name under one parent, so this error is thrown.
Solutions
- Rename the source folder before moving, or rename the conflicting folder in the destination
- Pick a different destination folder
- Check the destination for a folder with the same name and merge contents instead of moving
Example fix
// before
move({source: {type: 'folder', folderName: 'Assets', ...}, destination: {type: 'folder', parentName: 'Media', folderName: null}});
// after
// rename source first
move({source: {type: 'folder', folderName: 'Assets2', ...}, destination: {type: 'folder', parentName: 'Media', folderName: null}}); Defensive patterns
Strategy: validation
Validate before calling
const siblingNames = foldersIn(destinationParentFolderName).map((f) => f.name);
if (siblingNames.includes(sourceFolderName)) alert(`A folder named "${sourceFolderName}" already exists there`); Type guard
const nameTaken = (existing: {name: string; parent: string | null}[], name: string, parent: string | null) => existing.some((f) => f.name === name && f.parent === parent); Try / catch
try {
await applyCodemod({transformation});
} catch (e) {
if (String(e).includes('already exists in the destination')) {
// prompt the user to rename or merge
} else throw e;
} Prevention
- Check sibling folder names at the destination before initiating the move
- Enforce unique folder names per parent when creating folders
- Offer rename/merge flows instead of raw moves when collisions are detected
When it happens
Trigger: Calling applyCodemod to move a folder whose name already exists among folders sharing the computed destinationParentFolderName — e.g. moving folder 'Assets' into a parent that already contains an 'Assets' folder.
Common situations: Studio drag-drop onto a destination that visually contains a same-named folder; scripted moves without name-collision checks; duplicate names created by prior manual edits.
Related errors
- A folder cannot be moved inside itself
- New composition ID does not match installation target
- New composition source does not match installation target
- Overlapping source edit ranges
- A custom role ARN must either be "undefined" or a string…
AI-assisted analysis of remotion-dev/remotion@46a3a6bf13 (2026-09-02).
Data as JSON: /api/errors/923e03b253f301bd.
Report an issue: GitHub.
Appendix: source
Thrown at packages/studio-codemods/src/recast-mods.ts:716
sourceFolderPath !== null &&
destinationParentFolderName !== null &&
(destinationParentFolderName === sourceFolderPath ||
destinationParentFolderName.startsWith(`${sourceFolderPath}/`))
) {
throw new Error('A folder cannot be moved inside itself');
}
if (transformation.source.type === 'folder') {
const sourceFolderName = transformation.source.folderName;
if (
folders.some(
(folder) =>
folder.node !== sourceItem.node &&
folder.name === sourceFolderName &&
folder.parentFolderName === destinationParentFolderName,
)
) {
throw new Error(
`A folder named "${sourceFolderName}" already exists in the destination`,
);
}
}
const sourceReturnStatement = getEnclosingReturnStatement(sourceItem.path);
deleteJsxElementAtPath(sourceItem.path);
const element = stripParenthesizedExtra(sourceItem.node);
if (transformation.destination.type === 'root') {
appendElementToRoot({element, returnStatement: sourceReturnStatement});
} else if (transformation.destination.type === 'folder') {
appendElementToFolder({
element,
folderElement: (destinationFolder as unknown as LocatedItem).node,
});
} else {
const targetItem = target as unknown as LocatedItem;
const targetIndex = targetItem.parent.children.indexOf(targetItem.node);View on GitHub (pinned to 46a3a6bf13)