remotion-dev/remotion · error · Error
Both an output flag (--output) and an output location as a p
Error message
Both an output flag (--output) and an output location as a positional argument were passed. Please choose only one of the ways.
What it means
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.
Source
Thrown at packages/cli/src/user-passed-output-location.ts:37
compositionId,
defaultExtension,
args,
type,
outputLocationFromUi,
compositionDefaultOutName,
}: {
compositionId: string;
outputLocationFromUi: string | null;
compositionDefaultOutName: string | null;
defaultExtension: string;
args: (string | number)[];
type: 'asset' | 'sequence';
}) => {
if (
typeof args[0] !== 'undefined' &&
typeof parsedCli.output !== 'undefined'
) {
throw new Error(
'Both an output flag (--output) and an output location as a positional argument were passed. Please choose only one of the ways.',
);
}
return (
getUserPassedOutputLocation(args, outputLocationFromUi) ??
getDefaultOutLocation({
compositionName: compositionId,
defaultExtension,
type,
compositionDefaultOutName,
})
);
};
View on GitHub (pinned to 78fe4bb3fd)
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).
Example fix
// before $ npx remotion render MyComp out.mp4 --output other.mp4 // after - keep one $ npx remotion render MyComp out.mp4
Defensive patterns
Strategy: validation
Validate before calling
const validateOutputArgs = (args: string[], hasOutputFlag: boolean) => {
if (typeof args[0] !== 'undefined' && hasOutputFlag) {
throw new Error('Pass either a positional output or --output, not both');
}
};
validateOutputArgs(positionalArgs, parsedCli.output !== undefined); Type guard
const hasBothOutputForms = (args: string[], outputFlag: unknown): boolean => typeof args[0] !== 'undefined' && typeof outputFlag !== 'undefined';
Prevention
- Pick one output-specification style and use it consistently in scripts.
- When composing commands programmatically, set either the positional or --output, never both.
When it happens
Trigger: Running `remotion render <comp> <positional-out> --output <flag-out>` (or `remotion still ...`) so that both the positional and the flag are set.
Common situations: 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.
Related errors
- The output directory of the image sequence cannot have an ex
- Comma-separated `--frames` cannot be combined with `--every-
- Cannot find composition with ID "${compNameResult.compName}"
- Cannot render an image sequence with a codec that renders no
- Comma-separated frame selections are only supported by the l
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/84ecd579a1c3824a.
Report an issue: GitHub.