remotion-dev/remotion · error · Error
The bundle path ${resolvedBundleDir} is not a directory. Pas
Error message
The bundle path ${resolvedBundleDir} is not a directory. Pass the directory returned by `bundle()` or created by `npx remotion bundle`. What it means
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.
Source
Thrown at packages/lambda/src/shared/validate-bundle-dir.ts:61
};
export const validateBundleDir = (bundleDir: unknown): string => {
if (typeof bundleDir !== 'string') {
throw new TypeError(
`The \`bundleDir\` must be a string, but received ${JSON.stringify(bundleDir)}.`,
);
}
const resolvedBundleDir = path.resolve(bundleDir);
if (!fs.existsSync(resolvedBundleDir)) {
throw new Error(
`The bundle directory ${resolvedBundleDir} does not exist. Run \`npx remotion bundle\` or pass a valid \`bundleDir\`.`,
);
}
if (!fs.statSync(resolvedBundleDir).isDirectory()) {
throw new Error(
`The bundle path ${resolvedBundleDir} is not a directory. Pass the directory returned by \`bundle()\` or created by \`npx remotion bundle\`.`,
);
}
const indexHtmlPath = path.join(resolvedBundleDir, 'index.html');
if (!fs.existsSync(indexHtmlPath) || !fs.statSync(indexHtmlPath).isFile()) {
throw new Error(
`The bundle directory ${resolvedBundleDir} does not contain an index.html file at its root.`,
);
}
const bundleScriptPath = path.join(resolvedBundleDir, 'bundle.js');
if (
!fs.existsSync(bundleScriptPath) ||
!fs.statSync(bundleScriptPath).isFile()
) {
throw new Error(
`The bundle directory ${resolvedBundleDir} does not contain a bundle.js file at its root.`,View on GitHub (pinned to 78fe4bb3fd)
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.
Example fix
// before
deploySiteFromBundle({bucketName, region, bundleDir: './out/index.html'})
// after
deploySiteFromBundle({bucketName, region, bundleDir: './out'}) Defensive patterns
Strategy: validation
Validate before calling
import fs from 'node:fs'
if (!fs.statSync(bundleDir).isDirectory()) {
throw new Error(`bundleDir is not a directory: ${bundleDir}`)
} Prevention
- 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.
When it happens
Trigger: Passing a path to an index.html, a .zip, or any file rather than the enclosing directory produced by bundle().
Common situations: 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.
Related errors
- Could not parse `window.remotion_publicPath` in the bundle i
- The bundle directory ${bundleDir} contains a symbolic link t
- The bundle directory ${resolvedBundleDir} does not exist. Ru
- The bundle directory ${resolvedBundleDir} does not contain a
- The bundle directory ${resolvedBundleDir} does not contain a
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/cb4b5eda7bd2ab24.
Report an issue: GitHub.