{"record":{"id":"3623a57c0feee758","repo":"remotion-dev/remotion","slug":"could-not-locate-the-destination-folder","errorCode":null,"errorMessage":"Could not locate the destination folder","messagePattern":"Could not locate the destination folder","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/studio-codemods/src/folder-source-edits.ts","lineNumber":405,"sourceCode":"\tif (codeMod.type === 'move-composition-to-folder') {\n\t\tif (codeMod.folderName === null) {\n\t\t\tconst root = getRegistrationRoot(source.path);\n\t\t\tinsertionEdit = getInsertionRootSourceEdit({\n\t\t\t\tinput,\n\t\t\t\tinsertion,\n\t\t\t\troot: root as never,\n\t\t\t\tnullRoot: null,\n\t\t\t\tprettierConfigOverride: null,\n\t\t\t\tinsertInside: root.type === 'JSXFragment',\n\t\t\t});\n\t\t} else {\n\t\t\tconst destination = getFolder({\n\t\t\t\tfolderName: codeMod.folderName,\n\t\t\t\titems,\n\t\t\t\tparentName: codeMod.parentName,\n\t\t\t});\n\t\t\tif (destination === null) {\n\t\t\t\tthrow new Error('Could not locate the destination folder');\n\t\t\t}\n\n\t\t\tinsertionEdit = getInsertionRootSourceEdit({\n\t\t\t\tinput,\n\t\t\t\tinsertion,\n\t\t\t\troot: destination.node as never,\n\t\t\t\tnullRoot: null,\n\t\t\t\tprettierConfigOverride: null,\n\t\t\t\tinsertInside: true,\n\t\t\t});\n\t\t}\n\t} else if (codeMod.destination.type === 'root') {\n\t\tconst root = getRegistrationRoot(source.path);\n\t\tinsertionEdit = getInsertionRootSourceEdit({\n\t\t\tinput,\n\t\t\tinsertion,\n\t\t\troot: root as never,\n\t\t\tnullRoot: null,","sourceCodeStart":387,"sourceCodeEnd":423,"githubUrl":"https://github.com/remotion-dev/remotion/blob/46a3a6bf13ca367376ff18bbb06dae2e87e0d068/packages/studio-codemods/src/folder-source-edits.ts#L387-L423","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before (destination folder missing)\n<Root>\n  <Composition id=\"MyComp\" ... />\n</Root>\n\n// after (create the folder, then the move succeeds)\n<Root>\n  <Folder name=\"Dest\">\n    <Composition id=\"MyComp\" ... />\n  </Folder>\n</Root>","handlingStrategy":"validation","validationCode":"const folders = collectFolderNames(input); // parse file, extract <Folder name=...> + nesting\nif (!folders.some((f) => f.name === destFolderName && f.parent === destParentName)) {\n  throw new Error(`Destination folder \"${destFolderName}\" not found in Root file`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  editFolderInSource({codeMod, input});\n} catch (e) {\n  if (e instanceof Error && e.message === 'Could not locate the destination folder') {\n    // create the folder first, then retry the move\n  }\n}","preventionTips":["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"],"tags":["ast","codemod","folder","move"],"backgroundTag":"record-not-found","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"}