remotion-dev/remotion · error · Error
The public directory was specified as "${p}", and while this
Error message
The public directory was specified as "${p}", and while this path exists on the filesystem, it is not a directory. What it means
validatePublicDir stats the configured path; if it exists but lstatSync says it is not a directory (i.e. it is a file, symlink to a file, or special file), it throws. The public folder must be an actual directory.
Source
Thrown at packages/bundler/src/validate-public-dir.ts:16
import fs from 'node:fs';
import path from 'node:path';
export const validatePublicDir = (p: string) => {
const {root} = path.parse(process.cwd());
if (p === root) {
throw new Error(
`The public directory was specified as "${p}", which is the root directory. This is not allowed.`,
);
}
try {
const stat = fs.lstatSync(p);
if (!stat.isDirectory()) {
throw new Error(
`The public directory was specified as "${p}", and while this path exists on the filesystem, it is not a directory.`,
);
}
} catch {
// Path does not exist
// Check if the parent path exists
const parentPath = path.dirname(p);
const exists = fs.existsSync(parentPath);
if (!exists) {
throw new Error(
`The public directory was specified as "${p}", but this folder does not exist and the parent directory "${parentPath}" does also not exist. Create at least the parent directory.`,
);
}
}
};
View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Point publicDir at an actual directory.
- If a file is occupying the name, remove or rename it and create a directory there.
- If using a symlink, ensure it targets a directory.
Example fix
// before
Config.setPublicDir('./public.json'); // a file
// after
Config.setPublicDir('./public'); // a directory Defensive patterns
Strategy: validation
Validate before calling
import fs from 'node:fs';
const assertPublicDirIsDirectory = (publicDir: string) => {
const stat = fs.lstatSync(publicDir); // throws if missing — see error 54
if (!stat.isDirectory()) {
throw new Error(`${publicDir} exists but is not a directory`);
}
}; Prevention
- Reserve the publicDir path for a directory; do not let a file occupy it.
- If you symlink the public dir, target a directory.
- Add a preflight check in CI that validates the public dir is a directory.
When it happens
Trigger: Config.publicDir pointing at a file path (e.g. './public.txt') or a symlink that resolves to a file rather than a directory.
Common situations: Typo in the path; the chosen name is already taken by a file; a symlink intended to point at a directory points at a file instead.
Related errors
- The public directory was specified as "${p}", but this folde
- The public directory was specified as "${p}", which is the r
- ${result.file} was chosen as the entry point (reason = ${res
- Detected Vite pre-bundling, which will break the worker. Ple
- bundle() was called without arguments
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/944d423678ba86b4.
Report an issue: GitHub.