{"record":{"id":"0c7365767a6b212b","repo":"remotion-dev/remotion","slug":"audio-must-be-one-of-base-foreground-both-or-no","errorCode":null,"errorMessage":"audio must be one of base, foreground, both, or none.","messagePattern":"audio must be one of base, foreground, both, or none\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/video-matting/src/separate-video-layers.ts","lineNumber":203,"sourceCode":"\t\toutput: options.outputs?.foreground,\n\t});\n\tif (\n\t\toptions.outputs?.base?.outputWritable !== undefined &&\n\t\toptions.outputs.base.outputWritable ===\n\t\t\toptions.outputs.foreground?.outputWritable\n\t) {\n\t\tthrow new TypeError(\n\t\t\t'outputs.base and outputs.foreground must not use the same outputWritable.',\n\t\t);\n\t}\n\n\tgetVideoMattingModelInfo(options.model ?? 'modnet');\n\n\tif (\n\t\toptions.audio !== undefined &&\n\t\t!AUDIO_DESTINATIONS.includes(options.audio)\n\t) {\n\t\tthrow new TypeError(\n\t\t\t'audio must be one of base, foreground, both, or none.',\n\t\t);\n\t}\n\n\tresolveVideoMattingQuality(options.videoBitrate ?? 'very-high');\n\tresolveVideoMattingQuality(options.audioBitrate ?? 'medium');\n\n\tif (\n\t\toptions.keyframeIntervalInSeconds !== undefined &&\n\t\t(!Number.isFinite(options.keyframeIntervalInSeconds) ||\n\t\t\toptions.keyframeIntervalInSeconds <= 0)\n\t) {\n\t\tthrow new TypeError(\n\t\t\t'keyframeIntervalInSeconds must be a positive finite number.',\n\t\t);\n\t}\n\n\tif (","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/video-matting/src/separate-video-layers.ts#L185-L221","documentation":"The audio option controls where the source audio is routed and must be one of the enumerated strings: 'base', 'foreground', 'both', or 'none'. Any other value is rejected with this TypeError (AUDIO_DESTINATIONS membership check).","triggerScenarios":"Passing audio: 'audio' or 'all' or 'keep'; passing true/false; typo like 'foreground ' with whitespace or wrong case 'Foreground'.","commonSituations":"Guessing the enum from docs memory; loading the value from a CLI flag or env var without normalizing; copying an option name from a different Remotion API.","solutions":["Set audio to exactly 'base', 'foreground', 'both', or 'none'","Normalize/validate dynamic values against the allowed list before calling","Omit audio to use the default"],"exampleFix":"// before\nawait separateVideoLayers({ src, outputs, audio: 'all' });\n// after\nawait separateVideoLayers({ src, outputs, audio: 'both' });","handlingStrategy":"validation","validationCode":"const AUDIO = ['base','foreground','both','none']; if (audio !== undefined && !AUDIO.includes(audio)) throw new TypeError(`audio must be one of ${AUDIO.join(', ')}`);","typeGuard":"const isAudioDestination = (v) => ['base','foreground','both','none'].includes(v);","tryCatchPattern":"try { await separateVideoLayers({ src, outputs, audio }); } catch (e) { if (e instanceof TypeError && e.message.includes('audio must be one of')) { /* fix enum value */ } else throw e; }","preventionTips":["Copy enum values exactly from docs/types","Trim and lowercase user/CLI-provided values before comparing","Type the option as a union in TypeScript"],"tags":["enum","validation","audio"],"backgroundTag":"invalid-enum-value","analyzedSha":"b2f4e34732f3c6c222ea029413e22dc402218cd7","analyzedAt":"2026-09-09T13:27:51.281Z","contentChangedAt":"2026-09-09T13:27:51.281Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}