remotion-dev/remotion · error · Error
${result.file} was chosen as the entry point (reason = ${res
Error message
${result.file} was chosen as the entry point (reason = ${result.reason}) but it is a directory - it needs to be a file. What it means
Thrown by findEntryPoint when the resolved entry path is a bundled-code directory (isBundledCode returned true, i.e. the path exists AND contains index.html) but the calling command passed allowDirectory=false. Remotion distinguishes source entry points (a .ts/.tsx file to bundle) from already-bundled serve directories; commands like render/studio that need a source file reject directories.
Source
Thrown at packages/cli/src/entry-point.ts:68
reason: FoundReason;
} => {
const result = findEntryPointInner(args, remotionRoot, logLevel);
if (result.file === null) {
return result;
}
if (RenderInternals.isServeUrl(result.file)) {
return result;
}
if (!existsSync(result.file)) {
throw new Error(
`${result.file} was chosen as the entry point (reason = ${result.reason}) but it does not exist.`,
);
}
if (result.isDirectory && !allowDirectory) {
throw new Error(
`${result.file} was chosen as the entry point (reason = ${result.reason}) but it is a directory - it needs to be a file.`,
);
}
return result;
};
const isBundledCode = (p: string) => {
return existsSync(p) && existsSync(path.join(p, 'index.html'));
};
const findEntryPointInner = (
args: (string | number)[],
remotionRoot: string,
logLevel: LogLevel,
): {
file: string | null;
isDirectory: boolean;View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Pass the source entry file (e.g. src/index.tsx) instead of the bundled output directory.
- If you intended to serve a pre-bundled directory, use a serve URL (http://localhost:port) which is detected earlier via RenderInternals.isServeUrl and returned without this check.
- For commands that accept a directory (allowDirectory=true), confirm you are invoking the correct subcommand.
Example fix
// before $ npx remotion render ./build MyComp out.mp4 # ./build has index.html // after - point at the source file $ npx remotion render ./src/index.tsx MyComp out.mp4
Defensive patterns
Strategy: validation
Validate before calling
import {existsSync, statSync} from 'node:fs';
const isSourceFile = (p: string) => {
if (!existsSync(p)) return false;
const stat = statSync(p);
return stat.isFile() && /\.(ts|tsx|js|mjs)$/.test(p);
};
// ensure you pass a source file, not a bundle directory
if (!isSourceFile(entryPath)) {
throw new Error('Pass a .ts/.tsx source entry file, not a directory');
} Type guard
const isBundledDir = (p: string): boolean => existsSync(p) && existsSync(path.join(p, 'index.html'));
Prevention
- Distinguish serve URLs (http://...) from local paths before passing them in.
- Never reuse a `remotion bundle` output directory as a render entry point.
- If automating, assert the entry path is a file with statSync().isFile().
When it happens
Trigger: Passing a build output directory (containing index.html, e.g. a previously bundled public/ or dist/) as the entry point to a command that sets allowDirectory=false. Passing a serve-url-like local directory path when the command expects a source file.
Common situations: Pointing the CLI at a static bundle folder instead of src/index.tsx; reusing a directory left over from `remotion bundle`; confusing a serve URL (`http://localhost:3000`) with a local bundled directory.
Related errors
- ${result.file} was chosen as the entry point (reason = ${res
- Could not determine version of installed Remotion packages:
- bundle() was called without the `entryPoint` option
- You passed ${entryPoint} as your entry point, but this file
- The public directory was specified as "${p}", and while this
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/5f990ef935f57fdf.
Report an issue: GitHub.