remotion-dev/remotion · error · TypeError

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

Error message

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

What it means

validateMax throws this TypeError when the noiseDisplacement `passes` prop exceeds the maximum allowed value of 12 (MAX_PASSES). This is checked after validatePositive confirms passes > 0. The shader uses a fixed loop bound of 12 iterations, so values above 12 cannot be honored.

Source

Thrown at packages/effects/src/noise-displacement.ts:214

	if (!Number.isInteger(value)) {
		throw new TypeError(
			`"${name}" must be an integer, but got ${JSON.stringify(value)}`,
		);
	}
};

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 validateMax = (value: number, max: number, name: string): void => {
	if (value > max) {
		throw new TypeError(
			`"${name}" must be <= ${max}, but got ${JSON.stringify(value)}`,
		);
	}
};

const validateNoiseDisplacementParams = (
	params: NoiseDisplacementParams,
): void => {
	assertEffectParamsObject(params, 'Noise Displacement');
	assertRequiredUvCoordinate(params.center, 'center');
	assertRequiredFiniteNumber(params.radius, 'radius');
	assertOptionalFiniteNumber(params.strength, 'strength');
	assertOptionalFiniteNumber(params.seed, 'seed');
	assertOptionalFiniteNumber(params.grainSize, 'grainSize');
	assertOptionalFiniteNumber(params.passes, 'passes');
	assertOptionalIntegerNumber(params.passes, 'passes');
	assertOptionalFiniteNumber(params.blur, 'blur');
	assertOptionalFiniteNumber(params.feather, 'feather');

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Set passes to an integer between 1 and 12: noiseDisplacement({ passes: 6 }).
  2. If you need more samples, combine with a higher grainSize or strength instead.
  3. Clamp dynamic values: passes: Math.min(12, Math.max(1, Math.round(value))).
  4. Omit passes to use the default of 6.

Example fix

// before
noiseDisplacement({ center: [0.5, 0.5], radius: 0.5, passes: 20 })

// after
noiseDisplacement({ center: [0.5, 0.5], radius: 0.5, passes: 12 })
Defensive patterns

Strategy: validation

Validate before calling

// Validate passes upper bound before calling noiseDisplacement()
const MAX_PASSES = 12;
if (params.passes !== undefined && params.passes > MAX_PASSES) {
  throw new Error(`passes must be <= ${MAX_PASSES}, got ${params.passes}`);
}
const result = noiseDisplacement(params);

Prevention

When it happens

Trigger: Calling noiseDisplacement({ passes: 13 }) or any integer value greater than 12. Values like passes: 20, passes: 100, etc.

Common situations: Assuming more passes means better quality and setting a high number; dynamic computation that exceeds 12; copy-pasting from examples with different limits; misunderstanding the shader's fixed loop constraint.

Related errors


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