{"record":{"id":"9fc2f57a397205ba","repo":"remotion-dev/remotion","slug":"baseerror-foregrounderror-invalid-output","errorCode":null,"errorMessage":"${baseError ?? foregroundError ?? 'Invalid output path.'}","messagePattern":"\\$\\{baseError \\?\\? foregroundError \\?\\? 'Invalid output path\\.'\\}","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/studio/src/components/WebMcp.tsx","lineNumber":753,"sourceCode":"\t\t\t\t\t\tconst foregroundOutputPath =\n\t\t\t\t\t\t\tinput.foregroundOutputPath ?? `${baseName}-foreground.webm`;\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\ttypeof baseOutputPath !== 'string' ||\n\t\t\t\t\t\t\ttypeof foregroundOutputPath !== 'string'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthrow new Error('Output paths must be strings.');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst baseError = validatePublicOutputName({\n\t\t\t\t\t\t\textension: '.webm',\n\t\t\t\t\t\t\toutName: baseOutputPath,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tconst foregroundError = validatePublicOutputName({\n\t\t\t\t\t\t\textension: '.webm',\n\t\t\t\t\t\t\toutName: foregroundOutputPath,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif (baseError !== null || foregroundError !== null) {\n\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\tbaseError ?? foregroundError ?? 'Invalid output path.',\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tbaseOutputPath.normalize('NFC').toLowerCase() ===\n\t\t\t\t\t\t\tforegroundOutputPath.normalize('NFC').toLowerCase()\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t'Background and foreground outputs must be different.',\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst jobId = addVideoMattingJob({\n\t\t\t\t\t\t\taudio,\n\t\t\t\t\t\t\tbaseOutName: baseOutputPath,\n\t\t\t\t\t\t\tdisplayName,\n\t\t\t\t\t\t\tforegroundOutName: foregroundOutputPath,","sourceCodeStart":735,"sourceCodeEnd":771,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/studio/src/components/WebMcp.tsx#L735-L771","documentation":"Thrown when validatePublicOutputName rejects either output name (null message falls back to 'Invalid output path.'). The validator enforces the .webm extension and that the name is a safe public-file-relative output name.","triggerScenarios":"Passing output paths without the .webm extension, containing path separators or traversal (../), absolute paths, or otherwise invalid public output names.","commonSituations":"Passing an absolute filesystem path instead of a public-relative name, missing the extension, or trying to write outside the output directory (path traversal attempt).","solutions":["Use public-relative names ending in .webm, e.g. 'my-video-base.webm'.","Remove directory separators and '..' from the output names.","Read the thrown baseError/foregroundError message for the exact rule violated."],"exampleFix":"// before\n{ baseOutputPath: '/tmp/out.mp4' }\n// after\n{ baseOutputPath: 'out-base.webm' }","handlingStrategy":"validation","validationCode":"const valid = (n: string) => n.endsWith('.webm') && !n.includes('/') && !n.includes('\\\\') && !n.includes('..');\nif (!valid(base) || !valid(foreground)) throw new Error('Use public-relative .webm names');","typeGuard":null,"tryCatchPattern":"try { await separate(input); } catch (e) { if (/Invalid output|public/i.test(e.message)) { /* sanitize names */ } else throw e; }","preventionTips":["Always end output names in .webm.","Use plain file names relative to the output location, never absolute paths or '..'.","Reuse the same validatePublicOutputName rule in your caller for pre-checks."],"tags":["validation","output-path","path-format"],"backgroundTag":"invalid-argument-format","analyzedSha":"b2f4e34732f3c6c222ea029413e22dc402218cd7","analyzedAt":"2026-09-09T13:27:51.281Z","contentChangedAt":"2026-09-09T13:27:51.281Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}