{"record":{"id":"cb4b5eda7bd2ab24","repo":"remotion-dev/remotion","slug":"the-bundle-path-resolvedbundledir-is-not-a-dire","errorCode":null,"errorMessage":"The bundle path ${resolvedBundleDir} is not a directory. Pass the directory returned by `bundle()` or created by `npx remotion bundle`.","messagePattern":"The bundle path (.+?) is not a directory\\. Pass the directory returned by `bundle\\(\\)` or created by `npx remotion bundle`\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/lambda/src/shared/validate-bundle-dir.ts","lineNumber":61,"sourceCode":"};\n\nexport const validateBundleDir = (bundleDir: unknown): string => {\n\tif (typeof bundleDir !== 'string') {\n\t\tthrow new TypeError(\n\t\t\t`The \\`bundleDir\\` must be a string, but received ${JSON.stringify(bundleDir)}.`,\n\t\t);\n\t}\n\n\tconst resolvedBundleDir = path.resolve(bundleDir);\n\n\tif (!fs.existsSync(resolvedBundleDir)) {\n\t\tthrow new Error(\n\t\t\t`The bundle directory ${resolvedBundleDir} does not exist. Run \\`npx remotion bundle\\` or pass a valid \\`bundleDir\\`.`,\n\t\t);\n\t}\n\n\tif (!fs.statSync(resolvedBundleDir).isDirectory()) {\n\t\tthrow new Error(\n\t\t\t`The bundle path ${resolvedBundleDir} is not a directory. Pass the directory returned by \\`bundle()\\` or created by \\`npx remotion bundle\\`.`,\n\t\t);\n\t}\n\n\tconst indexHtmlPath = path.join(resolvedBundleDir, 'index.html');\n\tif (!fs.existsSync(indexHtmlPath) || !fs.statSync(indexHtmlPath).isFile()) {\n\t\tthrow new Error(\n\t\t\t`The bundle directory ${resolvedBundleDir} does not contain an index.html file at its root.`,\n\t\t);\n\t}\n\n\tconst bundleScriptPath = path.join(resolvedBundleDir, 'bundle.js');\n\tif (\n\t\t!fs.existsSync(bundleScriptPath) ||\n\t\t!fs.statSync(bundleScriptPath).isFile()\n\t) {\n\t\tthrow new Error(\n\t\t\t`The bundle directory ${resolvedBundleDir} does not contain a bundle.js file at its root.`,","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda/src/shared/validate-bundle-dir.ts#L43-L79","documentation":"Thrown by validateBundleDir() when the resolved path exists but fs.statSync reports it is not a directory (e.g. it is a regular file). The deploy flow needs a directory containing the bundle tree, not a single file.","triggerScenarios":"Passing a path to an index.html, a .zip, or any file rather than the enclosing directory produced by bundle().","commonSituations":"Mistakenly pointing bundleDir at the bundle's index.html or at a packaged archive instead of the unpacked directory; confusing `bundle()` (returns dir) with `npx remotion bundle` output flags.","solutions":["Pass the directory returned by bundle(), not a file inside it.","If you have an archive, unpack it first and pass the extracted directory.","Check `fs.statSync(path).isDirectory()` before calling deploy."],"exampleFix":"// before\ndeploySiteFromBundle({bucketName, region, bundleDir: './out/index.html'})\n// after\ndeploySiteFromBundle({bucketName, region, bundleDir: './out'})","handlingStrategy":"validation","validationCode":"import fs from 'node:fs'\nif (!fs.statSync(bundleDir).isDirectory()) {\n  throw new Error(`bundleDir is not a directory: ${bundleDir}`)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass the directory returned by bundle(), not a file path inside it.","Add a pre-flight isDirectory() check in deploy wrappers.","Document the expected bundleDir shape for downstream users."],"tags":["bundling","filesystem","validation"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}