{"record":{"id":"81a2cf5889a1c0db","repo":"remotion-dev/remotion","slug":"the-filename-must-match-0-9a-za-z","errorCode":null,"errorMessage":"The `filename` must match \"/^([0-9a-zA-Z-!_.*'()/:&$@=;+,?]+)/g\". Use forward slashes only, even on Windows.","messagePattern":"The `filename` must match \"/\\^\\(\\[0-9a-zA-Z-!_\\.\\*'\\(\\)/:&\\$@=;\\+,\\?\\]\\+\\)/g\"\\. Use forward slashes only, even on Windows\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/validation/validate-artifact.ts","lineNumber":15,"sourceCode":"import type {TRenderAsset} from '../CompositionManager';\n\nexport const validateArtifactFilename = (filename: unknown) => {\n\tif (typeof filename !== 'string') {\n\t\tthrow new TypeError(\n\t\t\t`The \"filename\" must be a string, but you passed a value of type ${typeof filename}`,\n\t\t);\n\t}\n\n\tif (filename.trim() === '') {\n\t\tthrow new Error('The `filename` must not be empty');\n\t}\n\n\tif (!filename.match(/^([0-9a-zA-Z-!_.*'()/:&$@=;+,?]+)/g)) {\n\t\tthrow new Error(\n\t\t\t'The `filename` must match \"/^([0-9a-zA-Z-!_.*\\'()/:&$@=;+,?]+)/g\". Use forward slashes only, even on Windows.',\n\t\t);\n\t}\n};\n\nconst validateContent = (content: unknown) => {\n\tif (typeof content !== 'string' && !(content instanceof Uint8Array)) {\n\t\tthrow new TypeError(\n\t\t\t`The \"content\" must be a string or Uint8Array, but you passed a value of type ${typeof content}`,\n\t\t);\n\t}\n\n\tif (typeof content === 'string' && content.trim() === '') {\n\t\tthrow new Error('The `content` must not be empty');\n\t}\n};\n\nexport const validateRenderAsset = (artifact: TRenderAsset) => {","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/validation/validate-artifact.ts#L1-L33","documentation":"validateArtifactFilename enforces that the filename only contains characters in the set [0-9a-zA-Z-!_.*'()/:&$@=;+,?] and uses forward slashes for path separation. Backslashes, spaces, angle brackets, and most punctuation are rejected to keep filenames portable across operating systems and safe for the render manifest. The check exists because Windows backslashes and spaces commonly break render pipelines.","triggerScenarios":"Registering an artifact whose filename contains a backslash (filename='dir\\\\file.txt'), a space (filename='my file.txt'), or any character outside the allowed set such as <, >, |, \", #, %, ^, ~, [, ], {, }, `.","commonSituations":"Using path.join on Windows which produces backslashes; copying a filename with spaces from an OS file dialog; embedding query-string characters like # or % that are not in the allowed set.","solutions":["Replace backslashes with forward slashes: filename = filename.replace(/\\\\/g, '/').","Remove or replace spaces and disallowed characters: use hyphens or underscores instead.","Construct paths with forward slashes explicitly, e.g. 'subdir/output.json'.","If you need a space or special char in the displayed name, encode it in the content/metadata instead of the filename."],"exampleFix":"// before (on Windows)\nconst filename = path.join('subdir', 'my file.txt'); // 'subdir\\\\my file.txt'\nregisterRenderAsset({type: 'artifact', filename, content});\n// after\nconst filename = 'subdir/my-file.txt';\nregisterRenderAsset({type: 'artifact', filename, content});","handlingStrategy":"validation","validationCode":"const ALLOWED = /^[0-9a-zA-Z\\-!_.*'()\\/:&$@=;+,?]+$/;\nif (typeof filename !== 'string' || !ALLOWED.test(filename)) {\n  throw new Error('filename contains disallowed characters; use forward slashes');\n}","typeGuard":"const ARTIFACT_FILENAME_RE = /^[0-9a-zA-Z\\-!_.*'()\\/:&$@=;+,?]+$/;\nconst isValidArtifactFilename = (v: unknown): v is string =>\n  typeof v === 'string' &&\n  v.trim().length > 0 &&\n  ARTIFACT_FILENAME_RE.test(v);","tryCatchPattern":null,"preventionTips":["Build paths with forward slashes only; never use path.join on Windows for artifact filenames.","Avoid spaces and punctuation outside the allowed set; use hyphens or underscores as separators.","Sanitize any user-supplied filename (strip/replace disallowed chars) before registering it."],"tags":["validation","artifacts","rendering","filename","cross-platform","windows"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}