remotion-dev/remotion · error · Error

Could not find the root file of the project

Error message

Could not find the root file of the project

What it means

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.

Source

Thrown at packages/browser-studio/src/browser-studio-operations.ts:303

		codemod.source.type === 'folder'
	) {
		const folderFile = getFolderFile({
			folderName: codemod.source.folderName,
			project,
		});
		if (folderFile === null) {
			throw new Error(`Could not find folder "${codemod.source.folderName}"`);
		}

		return findProjectFile({filePath: folderFile, project});
	}

	const rootFile = getRootFileForProject({
		entryPoint: project.entryPoint,
		project,
	});
	if (rootFile === null) {
		throw new Error('Could not find the root file of the project');
	}

	return findProjectFile({filePath: rootFile, project});
};

const makeNewCompositionComponentSource = (componentName: string) =>
	`import React from 'react';

export const ${componentName}: React.FC = () => {
	return null;
};
`;

const getElementInstallPlanForProject = async ({
	destination,
	element,
	installationName,
	project,

View on GitHub (pinned to b2f4e34732)

Solutions

  1. Verify project.entryPoint resolves to an existing key in project.files before applying codemods.
  2. Rebuild or re-sync the VirtualProject so entryPoint and files agree.
  3. Normalize file paths to forward slashes and absolute form when constructing the project.

Example fix

// before
const project = {
  entryPoint: 'src/index.tsx', // not a key of files
  files: {'/project/src/index.tsx': source},
};

// after
const project = {
  entryPoint: '/project/src/index.tsx',
  files: {'/project/src/index.tsx': source},
};
Defensive patterns

Strategy: validation

Validate before calling

const entryPointIsResolvable = (project: VirtualProject): boolean => {
  const candidates = [
    project.entryPoint,
    project.entryPoint.replaceAll('\\', '/'),
  ];
  return candidates.some((c) => project.files[c] !== undefined);
};

if (!entryPointIsResolvable(project)) {
  // fix entryPoint or re-sync files before applying codemods
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of remotion-dev/remotion@b2f4e34732 (2026-08-22). Data as JSON: /api/errors/ca68fc035c8e6e9e. Report an issue: GitHub.