remotion-dev/remotion · error · TypeError

The "${nameOfProp}" prop ${location} must be positive, but g

Error message

The "${nameOfProp}" prop ${location} must be positive, but got ${amount}.

What it means

`validateDimension` requires `width`/`height` to be strictly positive (> 0). Zero or negative dimensions are rejected as the last dimension check, since a render needs at least one pixel on each axis.

Source

Thrown at packages/core/src/validation/validate-dimensions.ts:31

		throw new TypeError(
			`The "${nameOfProp}" prop ${location} must not be NaN, but is NaN.`,
		);
	}

	if (!Number.isFinite(amount)) {
		throw new TypeError(
			`The "${nameOfProp}" prop ${location} must be finite, but is ${amount}.`,
		);
	}

	if (amount % 1 !== 0) {
		throw new TypeError(
			`The "${nameOfProp}" prop ${location} must be an integer, but is ${amount}.`,
		);
	}

	if (amount <= 0) {
		throw new TypeError(
			`The "${nameOfProp}" prop ${location} must be positive, but got ${amount}.`,
		);
	}
}

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Ensure dimensions are at least 1; clamp: `Math.max(1, value)`.
  2. Treat 0/negative as an error and supply a real default.
  3. Check `> 0` before assigning.

Example fix

// before
const width = baseWidth - padding * 2; // can be <= 0
<Composition width={width} ... />
// after
const width = Math.max(1, baseWidth - padding * 2);
<Composition width={width} ... />
Defensive patterns

Strategy: validation

Validate before calling

if (w <= 0) { throw new Error('width must be positive'); }

Prevention

When it happens

Trigger: Setting `width`/`height` to `0`, a negative number, or a value that computes to <= 0 (e.g. subtraction overshoot, `Math.min` of negatives).

Common situations: A dynamic layout where a region collapses to 0 (empty content); subtracting padding that exceeds the size; sign errors in computation.

Related errors


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