remotion-dev/remotion · error · Error

The public directory was specified as "${p}", but this folde

Error message

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.

What it means

If the configured public directory does not exist, validatePublicDir checks whether its parent exists; if the parent is also missing, it throws rather than silently creating a deep chain of directories. Remotion will create the leaf folder but not an entire missing ancestor tree.

Source

Thrown at packages/bundler/src/validate-public-dir.ts:26

		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. Create at least the parent directory before bundling: mkdir -p the parent.
  2. Use the default './public' (Remotion creates it if the parent — usually the project root — exists).
  3. Correct the path to point where the folder actually lives.
  4. Add a setup step in CI/Scripts that ensures the public dir's parent exists.

Example fix

// before
Config.setPublicDir('./assets/public'); // ./assets does not exist

// after
// mkdir -p assets/public   (or)
Config.setPublicDir('./public');
Defensive patterns

Strategy: validation

Validate before calling

import fs from 'node:fs';
import path from 'node:path';
const ensurePublicDirParentExists = (publicDir: string) => {
  const parent = path.dirname(publicDir);
  if (!fs.existsSync(parent)) {
    fs.mkdirSync(parent, {recursive: true}); // or throw with a clearer message
  }
};

Prevention

When it happens

Trigger: publicDir points to a path whose parent directory does not exist, e.g. './a/b/c/public' when './a/b' does not exist.

Common situations: Typo in a nested path; referencing a folder that has not been created yet; wrong relative path after moving the project; CI checkout missing an expected directory.

Related errors


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