{"record":{"id":"60d20a6032a32b73","repo":"remotion-dev/remotion","slug":"outputs-layer-cannot-specify-both-outputtarget","errorCode":null,"errorMessage":"outputs.${layer} cannot specify both outputTarget and outputWritable.","messagePattern":"outputs\\.(.+?) cannot specify both outputTarget and outputWritable\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/video-matting/src/separate-video-layers.ts","lineNumber":132,"sourceCode":"\tif (!output || typeof output !== 'object' || Array.isArray(output)) {\n\t\tthrow new TypeError(`outputs.${layer} must be an object.`);\n\t}\n\n\tif (\n\t\toutput.outputTarget !== undefined &&\n\t\toutput.outputTarget !== 'arraybuffer' &&\n\t\toutput.outputTarget !== 'web-fs'\n\t) {\n\t\tthrow new TypeError(\n\t\t\t`outputs.${layer}.outputTarget must be arraybuffer or web-fs.`,\n\t\t);\n\t}\n\n\tif (\n\t\toutput.outputTarget !== undefined &&\n\t\toutput.outputWritable !== undefined\n\t) {\n\t\tthrow new TypeError(\n\t\t\t`outputs.${layer} cannot specify both outputTarget and outputWritable.`,\n\t\t);\n\t}\n\n\tif (output.outputWritable !== undefined) {\n\t\tif (\n\t\t\ttypeof WritableStream === 'undefined' ||\n\t\t\t!(output.outputWritable instanceof WritableStream)\n\t\t) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`outputs.${layer}.outputWritable must be a WritableStream.`,\n\t\t\t);\n\t\t}\n\n\t\tif (output.outputWritable.locked) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`outputs.${layer}.outputWritable must not already be locked.`,\n\t\t\t);","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/video-matting/src/separate-video-layers.ts#L114-L150","documentation":"A layer output may specify either outputTarget (built-in sink selection) or outputWritable (a custom WritableStream sink), but not both — they are conflicting ways to choose where bytes go. Specifying both raises this TypeError to avoid ambiguous output behavior.","triggerScenarios":"Calling separateVideoLayers({outputs: {video: {outputTarget: 'arraybuffer', outputWritable: myStream}}}).","commonSituations":"Merging default config (outputTarget) with user config (outputWritable) via object spread; adding outputWritable without removing the default outputTarget.","solutions":["Remove outputTarget when you supply outputWritable (the writable takes over as the sink).","Remove outputWritable when you want the built-in 'arraybuffer' or 'web-fs' target.","When merging configs, delete conflicting keys instead of naively spreading."],"exampleFix":"// before\noutputs: {video: {outputTarget: 'arraybuffer', outputWritable: stream}}\n// after\noutputs: {video: {outputWritable: stream}}","handlingStrategy":"validation","validationCode":"if (out.outputTarget !== undefined && out.outputWritable !== undefined) throw new TypeError('choose either outputTarget or outputWritable');","typeGuard":"null","tryCatchPattern":"try { await separateVideoLayers(opts); } catch (e) { if (e instanceof TypeError && e.message.includes('both outputTarget and outputWritable')) { delete layerConfig.outputTarget; await separateVideoLayers(opts); } else throw e; }","preventionTips":["Pick one sink mechanism per layer","When merging configs, delete outputTarget if outputWritable is set","Document which key wins in your config schema"],"tags":["typeerror","validation","conflicting-options"],"backgroundTag":"mutually-exclusive-options","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"}