{"record":{"id":"ca68fc035c8e6e9e","repo":"remotion-dev/remotion","slug":"could-not-find-the-root-file-of-the-project","errorCode":null,"errorMessage":"Could not find the root file of the project","messagePattern":"Could not find the root file of the project","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/browser-studio/src/browser-studio-operations.ts","lineNumber":303,"sourceCode":"\t\tcodemod.source.type === 'folder'\n\t) {\n\t\tconst folderFile = getFolderFile({\n\t\t\tfolderName: codemod.source.folderName,\n\t\t\tproject,\n\t\t});\n\t\tif (folderFile === null) {\n\t\t\tthrow new Error(`Could not find folder \"${codemod.source.folderName}\"`);\n\t\t}\n\n\t\treturn findProjectFile({filePath: folderFile, project});\n\t}\n\n\tconst rootFile = getRootFileForProject({\n\t\tentryPoint: project.entryPoint,\n\t\tproject,\n\t});\n\tif (rootFile === null) {\n\t\tthrow new Error('Could not find the root file of the project');\n\t}\n\n\treturn findProjectFile({filePath: rootFile, project});\n};\n\nconst makeNewCompositionComponentSource = (componentName: string) =>\n\t`import React from 'react';\n\nexport const ${componentName}: React.FC = () => {\n\treturn null;\n};\n`;\n\nconst getElementInstallPlanForProject = async ({\n\tdestination,\n\telement,\n\tinstallationName,\n\tproject,","sourceCodeStart":285,"sourceCodeEnd":321,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/browser-studio/src/browser-studio-operations.ts#L285-L321","documentation":"Fallback branch of resolveCodemodTargetFile: codemods that are not tied to a composition or folder (e.g. new-composition) target the project's entry file, derived from project.entryPoint via getRootFileForProject. If that returns null — the entry point file is not present in project.files — this error is thrown.","triggerScenarios":"applyCodemod for a non-composition, non-folder codemod when the file referenced by project.entryPoint does not exist in project.files (deleted, renamed, or the entryPoint string does not match the keys of the files map, e.g. relative vs absolute path or Windows backslashes).","commonSituations":"Host-side project sync that removes or moves the root file; manually constructing a VirtualProject whose entryPoint disagrees with the files record; path separator mismatches when building the project on Windows.","solutions":["Verify project.entryPoint resolves to an existing key in project.files before applying codemods.","Rebuild or re-sync the VirtualProject so entryPoint and files agree.","Normalize file paths to forward slashes and absolute form when constructing the project."],"exampleFix":"// before\nconst project = {\n  entryPoint: 'src/index.tsx', // not a key of files\n  files: {'/project/src/index.tsx': source},\n};\n\n// after\nconst project = {\n  entryPoint: '/project/src/index.tsx',\n  files: {'/project/src/index.tsx': source},\n};","handlingStrategy":"validation","validationCode":"const entryPointIsResolvable = (project: VirtualProject): boolean => {\n  const candidates = [\n    project.entryPoint,\n    project.entryPoint.replaceAll('\\\\', '/'),\n  ];\n  return candidates.some((c) => project.files[c] !== undefined);\n};\n\nif (!entryPointIsResolvable(project)) {\n  // fix entryPoint or re-sync files before applying codemods\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When constructing or syncing a VirtualProject, assert project.files[project.entryPoint] exists.","Normalize all project paths to absolute forward-slash form.","Update entryPoint whenever the root file is renamed or moved."],"tags":["codemod","entry-point","virtual-project","path-mismatch"],"backgroundTag":"entry-point-not-found","analyzedSha":"b2f4e34732f3c6c222ea029413e22dc402218cd7","analyzedAt":"2026-08-22T21:45:17.748Z","contentChangedAt":"2026-08-22T21:45:17.748Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}