{"record":{"id":"544f1dbef44b85b4","repo":"remotion-dev/remotion","slug":"the-sitename-argument-must-be-a-string-if-provid","errorCode":null,"errorMessage":"The 'siteName' argument must be a string if provided, but is ${JSON.stringify(siteName)}","messagePattern":"The 'siteName' argument must be a string if provided, but is (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/cloudrun/src/shared/validate-site-name.ts","lineNumber":9,"sourceCode":"const VALID_SITE_NAME_RE = /^[-0-9a-zA-Z!_.*'()]+$/;\n\nexport const validateSiteName = (siteName: unknown) => {\n\tif (typeof siteName === 'undefined') {\n\t\treturn;\n\t}\n\n\tif (typeof siteName !== 'string') {\n\t\tthrow new TypeError(\n\t\t\t`The 'siteName' argument must be a string if provided, but is ${JSON.stringify(\n\t\t\t\tsiteName,\n\t\t\t)}`,\n\t\t);\n\t}\n\n\tif (siteName === '.' || siteName === '..') {\n\t\tthrow new Error(\n\t\t\t'The `siteName` must not be `.` or `..`. You passed: ' + siteName + '.',\n\t\t);\n\t}\n\n\tif (!VALID_SITE_NAME_RE.test(siteName)) {\n\t\tthrow new Error(\n\t\t\t'The `siteName` must match the RegExp `/' +\n\t\t\t\tVALID_SITE_NAME_RE.source +\n\t\t\t\t'/`. You passed: ' +\n\t\t\t\tsiteName +","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/cloudrun/src/shared/validate-site-name.ts#L1-L27","documentation":"Thrown by validateSiteName() in @remotion/cloudrun when siteName is provided but is not a string. The validator allows undefined (siteName is optional and returns early in that case), but any other non-string type is rejected before the name is used to address a GCS site.","triggerScenarios":"Passing a siteName that is null, a number, an object, or an array. Note undefined is allowed; the common mistake is passing null explicitly or a numeric/site identifier object.","commonSituations":"Reading siteName from config that yields null when absent; passing a deployment descriptor object instead of its name string; using 0 or a numeric id as the site name.","solutions":["If the site name is optional, omit the field entirely (or pass undefined) rather than null.","Pass the string name returned by deploySite().","Coerce or validate upstream: typeof siteName === 'undefined' || typeof siteName === 'string'."],"exampleFix":"// before\ndeploySite({ siteName: config.site ?? null, ... });\n\n// after\ndeploySite({ ...(config.site ? { siteName: config.site } : {}), ... });","handlingStrategy":"type-guard","validationCode":"if (siteName !== undefined && typeof siteName !== 'string') {\n  throw new TypeError('siteName must be a string when provided');\n}","typeGuard":"const isOptionalSiteName = (\n  v: unknown,\n): v is string | undefined =>\n  v === undefined || typeof v === 'string';","tryCatchPattern":null,"preventionTips":["Omit siteName entirely when it is optional; do not pass null.","Pass the name string from deploySite(), not the descriptor object.","Coerce config values: undefined stays undefined, everything else must be a string."],"tags":["cloudrun","validation","typescript","configuration"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}