{"record":{"id":"6b33a5e08145211d","repo":"remotion-dev/remotion","slug":"you-must-pass-a-name-to-a-folder","errorCode":null,"errorMessage":"You must pass a name to a <Folder />.","messagePattern":"You must pass a name to a <Folder />\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/core/src/validation/validate-folder-name.ts","lineNumber":7,"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)}`;","sourceCodeStart":1,"sourceCodeEnd":25,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/validation/validate-folder-name.ts#L1-L25","documentation":"`validateFolderName` requires a non-null, non-undefined `name` on a `<Folder>`. Passing `null` or `undefined` throws 'You must pass a name'. The check runs during `<Folder>` rendering, before the type/format checks.","triggerScenarios":"Rendering `<Folder />` without a `name` prop, or with `name={null}`/`name={undefined}` (e.g. when the name is sourced from optional config that is absent).","commonSituations":"A dynamic folder name from config that is sometimes missing; destructuring that yields undefined; copy-paste leaving the prop off.","solutions":["Always provide a concrete `name` string on `<Folder>`.","If the folder is optional, conditionally render `<Folder>` only when a name exists.","Default to a real name: `name={maybeName ?? 'Untitled'}`."],"exampleFix":"// before\n<Folder name={folderNameFromConfig}>...</Folder>  // folderNameFromConfig undefined\n// after\n{folderNameFromConfig ? <Folder name={folderNameFromConfig}>...</Folder> : children}","handlingStrategy":"validation","validationCode":"if (name == null) { throw new TypeError('Folder requires a name'); }","typeGuard":"const hasFolderName = (n) => n !== undefined && n !== null;","tryCatchPattern":null,"preventionTips":["Always pass a literal name to <Folder>.","Conditionally render <Folder> when the name is optional."],"tags":["validation","folder","naming","missing-prop"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}