remotion-dev/remotion · error · TypeError

The "name" you pass into <Folder /> must be a string. Got: $

Error message

The "name" you pass into <Folder /> must be a string. Got: ${typeof name}

What it means

After confirming the `<Folder>` name is not null/undefined, `validateFolderName` requires it to be a string. A non-string truthy value (number, object, array, boolean) throws 'must be a string'.

Source

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

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. Pass a string: extract the right field or coerce with `String(value)`.
  2. Type the name source as string before rendering.
  3. Validate `typeof name === 'string'` for dynamic names.

Example fix

// before
<Folder name={category.id}>...</Folder>  // id is a number
// after
<Folder name={String(category.id)}>...</Folder>
Defensive patterns

Strategy: type-guard

Validate before calling

if (typeof name !== 'string') { throw new TypeError('Folder name must be a string'); }

Type guard

const isFolderNameString = (n) => typeof n === 'string';

Prevention

When it happens

Trigger: Passing `name` as a number (`<Folder name={1}>`), object, array, or boolean to `<Folder>`.

Common situations: Sourcing the folder name from a numeric id or an object `{label}` and passing it directly instead of extracting a string field.

Related errors


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