remotion-dev/remotion · error
Could not locate the destination folder
Error message
Could not locate the destination folder
What it means
Thrown by getMoveSourceEdits (folder-source-edits.ts:405) for `move-composition-to-folder` codemods when the destination folder (given by codeMod.folderName plus codeMod.parentName) does not exist among the located folder JSX elements in the file.
Solutions
- Confirm the destination <Folder name="..."> exists in the same Root file with the expected nesting
- Reload Studio to refresh its view of the file, then retry the move
- Create the destination folder first, then move the composition
- Move the composition manually inside the <Folder> in the editor
Example fix
// before (destination folder missing)
<Root>
<Composition id="MyComp" ... />
</Root>
// after (create the folder, then the move succeeds)
<Root>
<Folder name="Dest">
<Composition id="MyComp" ... />
</Folder>
</Root> Defensive patterns
Strategy: validation
Validate before calling
const folders = collectFolderNames(input); // parse file, extract <Folder name=...> + nesting
if (!folders.some((f) => f.name === destFolderName && f.parent === destParentName)) {
throw new Error(`Destination folder "${destFolderName}" not found in Root file`);
} Try / catch
try {
editFolderInSource({codeMod, input});
} catch (e) {
if (e instanceof Error && e.message === 'Could not locate the destination folder') {
// create the folder first, then retry the move
}
} Prevention
- Create the destination folder before moving compositions into it
- Refresh Studio state after renaming/deleting folders elsewhere
- Use the exact folder name and parent path from the file
When it happens
Trigger: Calling the codemod with a folderName/parentName pair for which getFolder() finds no <Folder name=...> direct/located element — the destination folder was deleted, renamed, nested differently, or never existed in this Root file.
Common situations: Stale Studio UI state after the destination folder was renamed or removed in another editor/window; moving a composition into a folder that lives in a different Root file; nested folder path given as a flat name.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- Could not find folder
- Could not find target folder
- Could not locate the folder to rename
- Could not locate the JSX element to move
- Could not locate the new folder
AI-assisted analysis of remotion-dev/remotion@46a3a6bf13 (2026-09-18).
Data as JSON: /api/errors/3623a57c0feee758.
Report an issue: GitHub.
Appendix: source
Thrown at packages/studio-codemods/src/folder-source-edits.ts:405
if (codeMod.type === 'move-composition-to-folder') {
if (codeMod.folderName === null) {
const root = getRegistrationRoot(source.path);
insertionEdit = getInsertionRootSourceEdit({
input,
insertion,
root: root as never,
nullRoot: null,
prettierConfigOverride: null,
insertInside: root.type === 'JSXFragment',
});
} else {
const destination = getFolder({
folderName: codeMod.folderName,
items,
parentName: codeMod.parentName,
});
if (destination === null) {
throw new Error('Could not locate the destination folder');
}
insertionEdit = getInsertionRootSourceEdit({
input,
insertion,
root: destination.node as never,
nullRoot: null,
prettierConfigOverride: null,
insertInside: true,
});
}
} else if (codeMod.destination.type === 'root') {
const root = getRegistrationRoot(source.path);
insertionEdit = getInsertionRootSourceEdit({
input,
insertion,
root: root as never,
nullRoot: null,View on GitHub (pinned to 46a3a6bf13)