remotion-dev/remotion · error · TypeError

"${name}" must be greater than 0, but got ${JSON.stringify(v

Error message

"${name}" must be greater than 0, but got ${JSON.stringify(value)}

What it means

Thrown by the Liquid contours effect's validatePositive helper when a resolved numeric parameter that must be > 0 is <= 0. The shipped validator applies this to spacing and scale (validateLiquidContoursParams calls validatePositive(r.spacing, 'spacing') and validatePositive(r.scale, 'scale')), after defaults (spacing 62, scale 300) are applied.

Source

Thrown at packages/effects/src/liquid-contours.ts:168

	cachedSecondColorRgba: ParsedColorRgba;
};

const resolve = (params: LiquidContoursParams): LiquidContoursResolved => ({
	firstColor: params.firstColor ?? DEFAULT_FIRST_COLOR,
	secondColor: params.secondColor ?? DEFAULT_SECOND_COLOR,
	spacing: params.spacing ?? DEFAULT_SPACING,
	scale: params.scale ?? DEFAULT_SCALE,
	complexity: params.complexity ?? DEFAULT_COMPLEXITY,
	smoothness: params.smoothness ?? DEFAULT_SMOOTHNESS,
	seed: params.seed ?? DEFAULT_SEED,
	offsetX: params.offsetX ?? DEFAULT_OFFSET_X,
	offsetY: params.offsetY ?? DEFAULT_OFFSET_Y,
	phase: params.phase ?? DEFAULT_PHASE,
});

const validatePositive = (value: number, name: string): void => {
	if (value <= 0) {
		throw new TypeError(
			`"${name}" must be greater than 0, but got ${JSON.stringify(value)}`,
		);
	}
};

const validateLiquidContoursParams = (params: LiquidContoursParams): void => {
	assertEffectParamsObject(params, 'Liquid contours');
	assertOptionalColor(params.firstColor, 'firstColor');
	assertOptionalColor(params.secondColor, 'secondColor');
	assertOptionalFiniteNumber(params.spacing, 'spacing');
	assertOptionalFiniteNumber(params.scale, 'scale');
	assertOptionalFiniteNumber(params.complexity, 'complexity');
	assertOptionalFiniteNumber(params.smoothness, 'smoothness');
	assertOptionalFiniteNumber(params.seed, 'seed');
	assertOptionalFiniteNumber(params.offsetX, 'offsetX');
	assertOptionalFiniteNumber(params.offsetY, 'offsetY');
	assertOptionalFiniteNumber(params.phase, 'phase');

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Set spacing to a value > 0 (schema min is 2) and scale to a value > 0 (schema min is 20).
  2. Clamp animated values: Math.max(2, spacing) and Math.max(20, scale).
  3. Leave spacing/scale undefined to use the defaults (62 and 300).

Example fix

// before
liquidContours({ spacing: animatedSpacing }) // can hit 0

// after
liquidContours({ spacing: Math.max(2, animatedSpacing) })
Defensive patterns

Strategy: validation

Validate before calling

const safeSpacing = Math.max(2, Number.isFinite(spacing) ? spacing : 62);
const safeScale = Math.max(20, Number.isFinite(scale) ? scale : 300);
liquidContours({ spacing: safeSpacing, scale: safeScale });

Type guard

const isPositive = (v: unknown): v is number =>
  typeof v === 'number' && Number.isFinite(v) && v > 0;

Prevention

When it happens

Trigger: Calling liquidContours({ spacing: 0 }) or liquidContours({ scale: -50 }) or any non-positive value for either. Other params (complexity, smoothness) are validated by validateUnitInterval instead, so they do not trigger this message.

Common situations: Animating spacing or scale down to/below zero; computing these from data that can be zero; confusing spacing (band-pair width) with complexity/smoothness (0..1 unit intervals).

Related errors


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