{"record":{"id":"e886f334d70f9362","repo":"remotion-dev/remotion","slug":"the-name-you-pass-into-folder-must-be-a-stri","errorCode":null,"errorMessage":"The \"name\" you pass into <Folder /> must be a string. Got: ${typeof name}","messagePattern":"The \"name\" you pass into <Folder /> must be a string\\. Got: (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/core/src/validation/validate-folder-name.ts","lineNumber":11,"sourceCode":"const getRegex = () => /^([a-zA-Z0-9-\\u4E00-\\u9FFF])+$/g;\n\nexport const isFolderNameValid = (name: string) => name.match(getRegex());\n\nexport const validateFolderName = (name: string | null) => {\n\tif (name === undefined || name === null) {\n\t\tthrow new TypeError('You must pass a name to a <Folder />.');\n\t}\n\n\tif (typeof name !== 'string') {\n\t\tthrow new TypeError(\n\t\t\t`The \"name\" you pass into <Folder /> must be a string. Got: ${typeof name}`,\n\t\t);\n\t}\n\n\tif (!isFolderNameValid(name)) {\n\t\tthrow new Error(\n\t\t\t`Folder name can only contain a-z, A-Z, 0-9 and -. You passed ${name}`,\n\t\t);\n\t}\n};\n\nexport const invalidFolderNameErrorMessage = `Folder name must match ${String(\n\tgetRegex(),\n)}`;\n","sourceCodeStart":1,"sourceCodeEnd":26,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/validation/validate-folder-name.ts#L1-L26","documentation":"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'.","triggerScenarios":"Passing `name` as a number (`<Folder name={1}>`), object, array, or boolean to `<Folder>`.","commonSituations":"Sourcing the folder name from a numeric id or an object `{label}` and passing it directly instead of extracting a string field.","solutions":["Pass a string: extract the right field or coerce with `String(value)`.","Type the name source as string before rendering.","Validate `typeof name === 'string'` for dynamic names."],"exampleFix":"// before\n<Folder name={category.id}>...</Folder>  // id is a number\n// after\n<Folder name={String(category.id)}>...</Folder>","handlingStrategy":"type-guard","validationCode":"if (typeof name !== 'string') { throw new TypeError('Folder name must be a string'); }","typeGuard":"const isFolderNameString = (n) => typeof n === 'string';","tryCatchPattern":null,"preventionTips":["Coerce numeric/object ids to string before using as a folder name.","Type folder-name sources as string."],"tags":["validation","folder","naming","type"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}