remotion-dev/remotion · error · Error

Composition id can only contain a-z, A-Z, 0-9, CJK character

Error message

Composition id can only contain a-z, A-Z, 0-9, CJK characters and -. You passed ${id}

What it means

A `<Composition>` id must match `/^([a-zA-Z0-9-\u4E00-\u9FFF])+$/g` — ASCII letters, digits, hyphen, and CJK Unified Ideographs (U+4E00–U+9FFF) only. `validateCompositionId` runs inside `<Composition>` registration and throws for any other character. The id is used as a URL/path segment, so it must be URL-safe and stable.

Source

Thrown at packages/core/src/validation/validate-composition-id.ts:7

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

export const isCompositionIdValid = (id: string) => id.match(getRegex());

export const validateCompositionId = (id: string) => {
	if (!isCompositionIdValid(id)) {
		throw new Error(
			`Composition id can only contain a-z, A-Z, 0-9, CJK characters and -. You passed ${id}`,
		);
	}
};

export const invalidCompositionErrorMessage = `Composition ID must match ${String(
	getRegex(),
)}`;

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Switch to kebab-case using only a-z, 0-9 and hyphen (e.g. `'my-comp'`).
  2. Remove file extensions, spaces, and slashes from the id.
  3. For nesting, use `<Folder>` instead of `/` in the id.
  4. Strip/replace disallowed characters programmatically before registering.

Example fix

// before
<Composition id="my_comp.v2" ... />
// after
<Composition id="my-comp-v2" ... />
Defensive patterns

Strategy: validation

Validate before calling

const ID_RE = /^([a-zA-Z0-9-\u4E00-\u9FFF])+$/g;
function assertCompositionId(id) {
  ID_RE.lastIndex = 0;
  if (!ID_RE.test(id)) {
    throw new Error('Invalid composition id: ' + id);
  }
}

Type guard

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

Prevention

When it happens

Trigger: Registering a `<Composition id="...">` whose value contains spaces, underscores, dots, slashes, colons, emoji, or any non-ASCII character outside the CJK Unified Ideographs block; e.g. `'my_comp'`, `'video.mp4'`, `'a/b'`, `'héllo'` (Latin diacritic outside range).

Common situations: Using snake_case or kebab.with.dots ids out of habit; embedding file extensions; trying to encode a folder path with `/`; copy-pasting an id with a trailing space; using accented Latin characters.

Related errors


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