{"record":{"id":"84ecd579a1c3824a","repo":"remotion-dev/remotion","slug":"both-an-output-flag-output-and-an-output-locat","errorCode":null,"errorMessage":"Both an output flag (--output) and an output location as a positional argument were passed. Please choose only one of the ways.","messagePattern":"Both an output flag \\(--output\\) and an output location as a positional argument were passed\\. Please choose only one of the ways\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/user-passed-output-location.ts","lineNumber":37,"sourceCode":"\tcompositionId,\n\tdefaultExtension,\n\targs,\n\ttype,\n\toutputLocationFromUi,\n\tcompositionDefaultOutName,\n}: {\n\tcompositionId: string;\n\toutputLocationFromUi: string | null;\n\tcompositionDefaultOutName: string | null;\n\tdefaultExtension: string;\n\targs: (string | number)[];\n\ttype: 'asset' | 'sequence';\n}) => {\n\tif (\n\t\ttypeof args[0] !== 'undefined' &&\n\t\ttypeof parsedCli.output !== 'undefined'\n\t) {\n\t\tthrow new Error(\n\t\t\t'Both an output flag (--output) and an output location as a positional argument were passed. Please choose only one of the ways.',\n\t\t);\n\t}\n\n\treturn (\n\t\tgetUserPassedOutputLocation(args, outputLocationFromUi) ??\n\t\tgetDefaultOutLocation({\n\t\t\tcompositionName: compositionId,\n\t\t\tdefaultExtension,\n\t\t\ttype,\n\t\t\tcompositionDefaultOutName,\n\t\t})\n\t);\n};\n","sourceCodeStart":19,"sourceCodeEnd":52,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/cli/src/user-passed-output-location.ts#L19-L52","documentation":"Thrown by getOutputLocation when both a positional output argument (args[0]) and the --output flag (parsedCli.output) are supplied. Remotion accepts either form but not both, because they would compete to specify the destination.","triggerScenarios":"Running `remotion render <comp> <positional-out> --output <flag-out>` (or `remotion still ...`) so that both the positional and the flag are set.","commonSituations":"Combining an npm script that already passes --output with a positional argument from the user; copy-pasting a command that mixes the two syntaxes; refactoring a script and forgetting to remove one form.","solutions":["Remove one of the two: either drop the --output flag or drop the positional output argument.","Standardise your scripts on a single form (positional is more common for render)."],"exampleFix":"// before\n$ npx remotion render MyComp out.mp4 --output other.mp4\n// after - keep one\n$ npx remotion render MyComp out.mp4","handlingStrategy":"validation","validationCode":"const validateOutputArgs = (args: string[], hasOutputFlag: boolean) => {\n  if (typeof args[0] !== 'undefined' && hasOutputFlag) {\n    throw new Error('Pass either a positional output or --output, not both');\n  }\n};\n\nvalidateOutputArgs(positionalArgs, parsedCli.output !== undefined);","typeGuard":"const hasBothOutputForms = (args: string[], outputFlag: unknown): boolean =>\n  typeof args[0] !== 'undefined' && typeof outputFlag !== 'undefined';","tryCatchPattern":null,"preventionTips":["Pick one output-specification style and use it consistently in scripts.","When composing commands programmatically, set either the positional or --output, never both."],"tags":["cli","render","output","conflicting-flags"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}