remotion-dev/remotion · error · Error

outputLocation must not be an empty string

Error message

outputLocation must not be an empty string

What it means

`Config.setOutputLocation()` rejects empty/whitespace-only strings with a dedicated error after the type check. The trim check at output-location.ts:12 means even `' '` is rejected, not just `''`.

Source

Thrown at packages/cli/src/config/output-location.ts:13

let currentOutputLocation: string | null = null;

export const setOutputLocation = (newOutputLocation: string) => {
	if (typeof newOutputLocation !== 'string') {
		throw new Error(
			`outputLocation must be a string but got ${typeof newOutputLocation} (${JSON.stringify(
				newOutputLocation,
			)})`,
		);
	}

	if (newOutputLocation.trim() === '') {
		throw new Error(`outputLocation must not be an empty string`);
	}

	currentOutputLocation = newOutputLocation;
};

export const getOutputLocation = () => currentOutputLocation;

export const resetOutputLocation = () => {
	currentOutputLocation = null;
};

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Provide a real path, e.g. `Config.setOutputLocation('out/video.mp4')`.
  2. When the source may be blank, fall back to a default: `Config.setOutputLocation(process.env.OUT?.trim() || 'out/video.mp4')`.

Example fix

// before
Config.setOutputLocation(process.env.OUT || '');
// after
Config.setOutputLocation(process.env.OUT?.trim() || 'out/video.mp4');
Defensive patterns

Strategy: validation

Validate before calling

const raw = (process.env.OUT ?? '').trim();
if (raw === '') {
  throw new Error('OUT must not be empty');
}
Config.setOutputLocation(raw);

Type guard

const isNonEmptyString = (v: unknown): v is string =>
  typeof v === 'string' && v.trim().length > 0;

Prevention

When it happens

Trigger: Calling `Config.setOutputLocation('')` or `Config.setOutputLocation(' ')`. Also triggered when an env var is set but blank (`OUT= remotion render ...`).

Common situations: Empty env var (`OUT=`); template literal that resolved to nothing (`Config.setOutputLocation(`out/${name}.mp4`)` with `name` undefined); trimmed user input from a form.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/0d3f3285ef3a2c1b. Report an issue: GitHub.