{"record":{"id":"2616a06ffb99fb6e","repo":"remotion-dev/remotion","slug":"could-not-find-folder-folderpath","errorCode":null,"errorMessage":"Could not find folder \"${folderPath}\"","messagePattern":"Could not find folder \"(.+?)\"","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/studio-codemods/src/recast-mods.ts","lineNumber":665,"sourceCode":"\t\t\ttransformation.destination.type === 'after') &&\n\t\ttarget === null\n\t) {\n\t\tthrow new Error(\n\t\t\t`Could not find ${getCompositionOrFolderLabel(transformation.destination.target)} as a reorder target`,\n\t\t);\n\t}\n\n\tif (\n\t\ttransformation.destination.type === 'folder' &&\n\t\tdestinationFolder === null\n\t) {\n\t\tconst folderPath = [\n\t\t\ttransformation.destination.parentName,\n\t\t\ttransformation.destination.folderName,\n\t\t]\n\t\t\t.filter(Boolean)\n\t\t\t.join('/');\n\t\tthrow new Error(`Could not find folder \"${folderPath}\"`);\n\t}\n\n\tif (target !== null && (target as LocatedItem).node === sourceItem.node) {\n\t\treturn {newAst: file, changesMade};\n\t}\n\n\tconst sourceFolderPath =\n\t\ttransformation.source.type === 'folder'\n\t\t\t? [transformation.source.parentName, transformation.source.folderName]\n\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t.join('/')\n\t\t\t: null;\n\tconst destinationParentFolderName =\n\t\ttransformation.destination.type === 'root'\n\t\t\t? null\n\t\t\t: transformation.destination.type === 'folder'\n\t\t\t\t? [\n\t\t\t\t\t\ttransformation.destination.parentName,","sourceCodeStart":647,"sourceCodeEnd":683,"githubUrl":"https://github.com/remotion-dev/remotion/blob/a6a7485a9aeb04219510fbe4874f8941486424df/packages/studio-codemods/src/recast-mods.ts#L647-L683","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure the destination folder (a <Folder name=\"...\"> element) exists in the composition file with exactly matching parentName and folderName","Regenerate the transformation from freshly read studio/composition state","Create the destination folder first, or move to destination {type: 'root'} as a fallback"],"exampleFix":"// before\ndestination: {type: 'folder', parentName: 'OldParent', folderName: 'MyFolder'}\n// after\n// match the actual folder layout\ndestination: {type: 'folder', parentName: 'NewParent', folderName: 'MyFolder'}","handlingStrategy":"validation","validationCode":"const folderExists = findFolderElement(ast, destination.parentName, destination.folderName);\nif (!folderExists) throw new Error(`Destination folder \"${[destination.parentName, destination.folderName].filter(Boolean).join('/')}\" does not exist`);","typeGuard":"const isFolderDestination = (d: Destination) => d.type === 'folder' && Boolean(d.folderName);","tryCatchPattern":"try {\n  await applyCodemod({transformation});\n} catch (e) {\n  if (String(e).startsWith('Could not find folder')) {\n    // create the folder or move to root\n  } else throw e;\n}","preventionTips":["Confirm the <Folder name=...> wrapper exists in the same file before moving into it","Sync transformation destinations after any folder rename/delete","Prefer reading folder structure from the AST rather than remembered UI state"],"tags":["codemod","ast","folder"],"backgroundTag":"codemod-target-not-found","analyzedSha":"a6a7485a9aeb04219510fbe4874f8941486424df","analyzedAt":"2026-09-02T16:25:19.997Z","contentChangedAt":"2026-09-02T16:25:19.997Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}