remotion-dev/remotion · error · TypeError

You must pass a name to a <Folder />.

Error message

You must pass a name to a <Folder />.

What it means

`validateFolderName` requires a non-null, non-undefined `name` on a `<Folder>`. Passing `null` or `undefined` throws 'You must pass a name'. The check runs during `<Folder>` rendering, before the type/format checks.

Source

Thrown at packages/core/src/validation/validate-folder-name.ts:7

const getRegex = () => /^([a-zA-Z0-9-\u4E00-\u9FFF])+$/g;

export const isFolderNameValid = (name: string) => name.match(getRegex());

export const validateFolderName = (name: string | null) => {
	if (name === undefined || name === null) {
		throw new TypeError('You must pass a name to a <Folder />.');
	}

	if (typeof name !== 'string') {
		throw new TypeError(
			`The "name" you pass into <Folder /> must be a string. Got: ${typeof name}`,
		);
	}

	if (!isFolderNameValid(name)) {
		throw new Error(
			`Folder name can only contain a-z, A-Z, 0-9 and -. You passed ${name}`,
		);
	}
};

export const invalidFolderNameErrorMessage = `Folder name must match ${String(
	getRegex(),
)}`;

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Always provide a concrete `name` string on `<Folder>`.
  2. If the folder is optional, conditionally render `<Folder>` only when a name exists.
  3. Default to a real name: `name={maybeName ?? 'Untitled'}`.

Example fix

// before
<Folder name={folderNameFromConfig}>...</Folder>  // folderNameFromConfig undefined
// after
{folderNameFromConfig ? <Folder name={folderNameFromConfig}>...</Folder> : children}
Defensive patterns

Strategy: validation

Validate before calling

if (name == null) { throw new TypeError('Folder requires a name'); }

Type guard

const hasFolderName = (n) => n !== undefined && n !== null;

Prevention

When it happens

Trigger: Rendering `<Folder />` without a `name` prop, or with `name={null}`/`name={undefined}` (e.g. when the name is sourced from optional config that is absent).

Common situations: A dynamic folder name from config that is sometimes missing; destructuring that yields undefined; copy-paste leaving the prop off.

Related errors


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