{"record":{"id":"5f990ef935f57fdf","repo":"remotion-dev/remotion","slug":"result-file-was-chosen-as-the-entry-point-reas-5f990e","errorCode":null,"errorMessage":"${result.file} was chosen as the entry point (reason = ${result.reason}) but it is a directory - it needs to be a file.","messagePattern":"(.+?) was chosen as the entry point \\(reason = (.+?)\\) but it is a directory - it needs to be a file\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/entry-point.ts","lineNumber":68,"sourceCode":"\treason: FoundReason;\n} => {\n\tconst result = findEntryPointInner(args, remotionRoot, logLevel);\n\tif (result.file === null) {\n\t\treturn result;\n\t}\n\n\tif (RenderInternals.isServeUrl(result.file)) {\n\t\treturn result;\n\t}\n\n\tif (!existsSync(result.file)) {\n\t\tthrow new Error(\n\t\t\t`${result.file} was chosen as the entry point (reason = ${result.reason}) but it does not exist.`,\n\t\t);\n\t}\n\n\tif (result.isDirectory && !allowDirectory) {\n\t\tthrow new Error(\n\t\t\t`${result.file} was chosen as the entry point (reason = ${result.reason}) but it is a directory - it needs to be a file.`,\n\t\t);\n\t}\n\n\treturn result;\n};\n\nconst isBundledCode = (p: string) => {\n\treturn existsSync(p) && existsSync(path.join(p, 'index.html'));\n};\n\nconst findEntryPointInner = (\n\targs: (string | number)[],\n\tremotionRoot: string,\n\tlogLevel: LogLevel,\n): {\n\tfile: string | null;\n\tisDirectory: boolean;","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/cli/src/entry-point.ts#L50-L86","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n$ npx remotion render ./build MyComp out.mp4   # ./build has index.html\n// after - point at the source file\n$ npx remotion render ./src/index.tsx MyComp out.mp4","handlingStrategy":"validation","validationCode":"import {existsSync, statSync} from 'node:fs';\n\nconst isSourceFile = (p: string) => {\n  if (!existsSync(p)) return false;\n  const stat = statSync(p);\n  return stat.isFile() && /\\.(ts|tsx|js|mjs)$/.test(p);\n};\n\n// ensure you pass a source file, not a bundle directory\nif (!isSourceFile(entryPath)) {\n  throw new Error('Pass a .ts/.tsx source entry file, not a directory');\n}","typeGuard":"const isBundledDir = (p: string): boolean =>\n  existsSync(p) && existsSync(path.join(p, 'index.html'));","tryCatchPattern":null,"preventionTips":["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()."],"tags":["cli","entry-point","filesystem"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}