remotion-dev/remotion · error

${baseError ?? foregroundError ?? 'Invalid output path.'}

Error message

${baseError ?? foregroundError ?? 'Invalid output path.'}

What it means

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.

Source

Thrown at packages/studio/src/components/WebMcp.tsx:753

						const foregroundOutputPath =
							input.foregroundOutputPath ?? `${baseName}-foreground.webm`;
						if (
							typeof baseOutputPath !== 'string' ||
							typeof foregroundOutputPath !== 'string'
						) {
							throw new Error('Output paths must be strings.');
						}

						const baseError = validatePublicOutputName({
							extension: '.webm',
							outName: baseOutputPath,
						});
						const foregroundError = validatePublicOutputName({
							extension: '.webm',
							outName: foregroundOutputPath,
						});
						if (baseError !== null || foregroundError !== null) {
							throw new Error(
								baseError ?? foregroundError ?? 'Invalid output path.',
							);
						}

						if (
							baseOutputPath.normalize('NFC').toLowerCase() ===
							foregroundOutputPath.normalize('NFC').toLowerCase()
						) {
							throw new Error(
								'Background and foreground outputs must be different.',
							);
						}

						const jobId = addVideoMattingJob({
							audio,
							baseOutName: baseOutputPath,
							displayName,
							foregroundOutName: foregroundOutputPath,

View on GitHub (pinned to b2f4e34732)

Solutions

  1. Use public-relative names ending in .webm, e.g. 'my-video-base.webm'.
  2. Remove directory separators and '..' from the output names.
  3. Read the thrown baseError/foregroundError message for the exact rule violated.

Example fix

// before
{ baseOutputPath: '/tmp/out.mp4' }
// after
{ baseOutputPath: 'out-base.webm' }
Defensive patterns

Strategy: validation

Validate before calling

const valid = (n: string) => n.endsWith('.webm') && !n.includes('/') && !n.includes('\\') && !n.includes('..');
if (!valid(base) || !valid(foreground)) throw new Error('Use public-relative .webm names');

Try / catch

try { await separate(input); } catch (e) { if (/Invalid output|public/i.test(e.message)) { /* sanitize names */ } else throw e; }

Prevention

When it happens

Trigger: Passing output paths without the .webm extension, containing path separators or traversal (../), absolute paths, or otherwise invalid public output names.

Common situations: 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).

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of remotion-dev/remotion@b2f4e34732 (2026-09-09). Data as JSON: /api/errors/9fc2f57a397205ba. Report an issue: GitHub.