remotion-dev/remotion · error · Error
The `siteName` must match the RegExp `/${VALID_SITE_NAME_RE.
Error message
The `siteName` must match the RegExp `/${VALID_SITE_NAME_RE.source}/`. You passed: ${siteName}. Check for invalid characters. What it means
Thrown by validateSiteName() in @remotion/lambda when siteName is a string but contains characters outside the allowed set. The allowed RegExp is /^[-0-9a-zA-Z!_.*'()]+$/ (letters, digits, '-', '_', '.', '*', "'", '(', ')', '!'). siteName feeds into S3 bucket/key naming where AWS forbids many characters.
Source
Thrown at packages/lambda/src/shared/validate-site-name.ts:23
return;
}
if (typeof siteName !== 'string') {
throw new TypeError(
`The 'siteName' argument must be a string if provided, but is ${JSON.stringify(
siteName,
)}`,
);
}
if (siteName === '.' || siteName === '..') {
throw new Error(
'The `siteName` must not be `.` or `..`. You passed: ' + siteName + '.',
);
}
if (!VALID_SITE_NAME_RE.test(siteName)) {
throw new Error(
'The `siteName` must match the RegExp `/' +
VALID_SITE_NAME_RE.source +
'/`. You passed: ' +
siteName +
'. Check for invalid characters.',
);
}
};
View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Restrict siteName to alphanumerics and hyphens/underscores (the safest subset), e.g. 'my-project'.
- Slugify free-form input before passing: name.toLowerCase().replace(/[^a-z0-9-]+/g, '-').
- Ensure the string is non-empty; pass undefined for the default.
Example fix
// before
await deploySite({ siteName: 'My Project v2!' }); // spaces are invalid
// after
const siteName = 'My Project v2!'.toLowerCase().replace(/[^a-z0-9-_.]+/g, '-');
await deploySite({ siteName }); Defensive patterns
Strategy: validation
Validate before calling
const SITE_NAME_RE = /^[-0-9a-zA-Z!_.*'()]+$/;
function toSiteName(raw: string): string | undefined {
const slug = raw.toLowerCase().replace(/[^a-z0-9-_.]+/g, '-').replace(/^-+|-+$/g, '');
return SITE_NAME_RE.test(slug) ? slug : undefined;
} Type guard
const isValidSiteName = (v: unknown): v is string => typeof v === 'string' && /^[-0-9a-zA-Z!_.*'()]+$/.test(v);
Prevention
- Restrict site names to the safe subset (alphanumeric, '-', '_').
- Run a slugify step on any free-form input.
- Reject the empty string explicitly (it fails the + quantifier).
When it happens
Trigger: Passing a siteName containing spaces, slashes, '@', '#', '&', '+', commas, colons, Unicode, or any character not in the allowed class. Also thrown for the empty string '' (the regex requires at least one character via +).
Common situations: Using a project name with spaces ('My Project'), an email ('team@corp.com'), a URL-style slug with '/', or a localized/Unicode name. Empty string from an untrimmed empty input.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- The 'siteName' argument must be a string if provided, but is
- The `siteName` must not be `.` or `..`. You passed: ${siteNa
- Pass --s3-output-provider-endpoint when using S3 output prov
- Pass --force-bucket-name when using S3 output provider flags
- Pass --out-name when using S3 output provider flags.
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/bd74b5768e10a928.
Report an issue: GitHub.