remotion-dev/remotion · error · TypeError

"${name}" must be >= -1, but got ${JSON.stringify(value)}

Error message

"${name}" must be >= -1, but got ${JSON.stringify(value)}

What it means

Thrown by validateSignedUnitInterval in @remotion/effects color-utils when a parameter constrained to the [-1, 1] range is given a value below -1. This guard protects signed-range parameters in effects like brightness (amount), colorCorrection (shadows, highlights, whites, blacks, temperature, tint, vibrance), and shadowsHighlights (shadows, highlights). The lower bound of -1 represents the extreme negative adjustment.

Source

Thrown at packages/effects/src/color-utils.ts:82

			`"${name}" must be <= 1, but got ${JSON.stringify(value)}`,
		);
	}
};

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

export const validateSignedUnitInterval = (
	value: number,
	name: string,
): void => {
	if (value < -1) {
		throw new TypeError(
			`"${name}" must be >= -1, but got ${JSON.stringify(value)}`,
		);
	}

	if (value > 1) {
		throw new TypeError(
			`"${name}" must be <= 1, but got ${JSON.stringify(value)}`,
		);
	}
};

export const clampColorChannel = (value: number): number => {
	return Math.max(0, Math.min(255, value));
};

export type ParsedColorRgba = readonly [number, number, number, number];

export const parseColorRgba = (

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Clamp the value to the [-1, 1] range before passing it: Math.max(-1, Math.min(1, value)).
  2. If animating with interpolate(), constrain outputRange to stay within [-1, 1] (e.g. outputRange: [-1, 1]).
  3. Check the parameter name in the error message to identify which signed-interval param overflowed.
  4. Review the effect docs — brightness amount and colorCorrection tonal params use -1 for full negative effect, +1 for full positive.

Example fix

// before
brightness({amount: Math.sin(t) * 2}) // can reach -2

// after
brightness({amount: Math.max(-1, Math.min(1, Math.sin(t)))})
Defensive patterns

Strategy: validation

Validate before calling

// Clamp to signed unit interval [-1, 1] before passing
const clamped = Math.max(-1, Math.min(1, value));
brightness({amount: clamped});

Type guard

const isSignedUnitInterval = (v: unknown): v is number =>
  typeof v === 'number' && Number.isFinite(v) && v >= -1 && v <= 1;

Prevention

When it happens

Trigger: Passing a value < -1 to brightness({amount: ...}), colorCorrection({shadows: ...}), colorCorrection({temperature: ...}), colorCorrection({vibrance: ...}), shadowsHighlights({shadows: ...}), or shadowsHighlights({highlights: ...}). For example brightness({amount: -1.5}) or colorCorrection({temperature: -2}).

Common situations: Using interpolate() with an outputRange that extends past -1 (e.g. [-2, 2]); confusing the signed unit-interval range [-1,1] with a non-negative multiplier range [0, inf); feeding a raw sine-wave oscillator output directly into a brightness amount without clamping; UI sliders with incorrect min attributes.

Related errors


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