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

  1. Point publicDir at an actual directory.
  2. If a file is occupying the name, remove or rename it and create a directory there.
  3. 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

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


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/944d423678ba86b4. Report an issue: GitHub.