remotion-dev/remotion · error

audio must be base, foreground, both, or none.

Error message

audio must be base, foreground, both, or none.

What it means

Thrown when the optional `input.audio` option of the video-matting tool is not one of the four allowed literals: 'base', 'foreground', 'both', or 'none'. It controls which audio track the separated outputs keep.

Source

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

						if (typeof modelName !== 'string') {
							throw new Error('model must be a string.');
						}

						const model = videoMatting
							.getAvailableModels()
							.find((candidate) => candidate.name === modelName)?.name;
						if (!model) {
							throw new Error(`Unknown video matting model: ${modelName}.`);
						}

						const audio = input.audio ?? 'base';
						if (
							audio !== 'base' &&
							audio !== 'foreground' &&
							audio !== 'both' &&
							audio !== 'none'
						) {
							throw new Error('audio must be base, foreground, both, or none.');
						}

						const videoBitrate = input.videoBitrate ?? 'very-high';
						if (
							(typeof videoBitrate !== 'number' ||
								!Number.isInteger(videoBitrate) ||
								videoBitrate <= 0) &&
							videoBitrate !== 'very-low' &&
							videoBitrate !== 'low' &&
							videoBitrate !== 'medium' &&
							videoBitrate !== 'high' &&
							videoBitrate !== 'very-high'
						) {
							throw new Error('videoBitrate is invalid.');
						}

						const src = staticFile(assetPath);
						const displayName = assetPath.split('/').at(-1) ?? assetPath;

View on GitHub (pinned to b2f4e34732)

Solutions

  1. Use exactly one of 'base' | 'foreground' | 'both' | 'none' (lowercase).
  2. Omit the field to use the default 'base'.
  3. Map your intent (e.g. keep original audio) to the closest allowed value before calling.

Example fix

// before
{ audio: 'background' }
// after
{ audio: 'base' }
Defensive patterns

Strategy: validation

Validate before calling

const AUDIO = ['base','foreground','both','none'] as const;
if (audio != null && !AUDIO.includes(audio)) throw new Error('audio must be base|foreground|both|none');

Type guard

const isAudioMode = (v: unknown): v is 'base'|'foreground'|'both'|'none' => v === 'base' || v === 'foreground' || v === 'both' || v === 'none';

Prevention

When it happens

Trigger: Passing audio: 'original', 'Base' (wrong case), 'bgs', a number, or any other value outside the four-case union.

Common situations: Guessing option names instead of reading the tool schema, uppercase/lowercase mixups, or agents inventing values like 'background-audio'.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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