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 the venetian-blinds effect's validatePositiveInteger when the slats parameter is an integer but is less than 1. This is the second check in validatePositiveInteger (after the integer check), enforcing the schema minimum of 1. A value of 0 or negative triggers this even though it passes Number.isInteger.

Source

Thrown at packages/effects/src/venetian-blinds.ts:106

		);
	}
};

const resolve = (p: VenetianBlindsParams): VenetianBlindsResolved => ({
	progress: p.progress ?? DEFAULT_PROGRESS,
	direction: p.direction ?? DEFAULT_DIRECTION,
	slats: p.slats ?? DEFAULT_SLATS,
});

const validatePositiveInteger = (value: number, name: string): void => {
	if (!Number.isInteger(value)) {
		throw new TypeError(
			`"${name}" must be an integer, but got ${JSON.stringify(value)}`,
		);
	}

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

const validateVenetianBlindsParams = (params: VenetianBlindsParams): void => {
	assertEffectParamsObject(params, 'Venetian blinds');
	assertOptionalFiniteNumber(params.progress, 'progress');
	assertOptionalFiniteNumber(params.slats, 'slats');
	assertOptionalEnum(params.direction, 'direction', VENETIAN_BLINDS_DIRECTIONS);

	const r = resolve(params);
	validateUnitInterval(r.progress, 'progress');
	validatePositiveInteger(r.slats, 'slats');
};

type VenetianBlindsState = {
	readonly gl: WebGL2RenderingContext;

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Pass a positive integer: venetianBlinds({slats: 12})
  2. Clamp computed values to at least 1: venetianBlinds({slats: Math.max(1, Math.round(value))})
  3. Omit slats to accept the default of 12
  4. Check the schema range: slats must be between 1 and 100 inclusive

Example fix

// before
const e = venetianBlinds({slats: Math.floor(width / 1000)});

// after
const e = venetianBlinds({slats: Math.max(1, Math.floor(width / 1000))});
Defensive patterns

Strategy: validation

Validate before calling

function isPositiveInteger(value: unknown): boolean {
  return typeof value === 'number' && Number.isInteger(value) && value >= 1;
}

// Before calling:
if (!isPositiveInteger(params.slats)) {
  throw new Error('slats must be a positive integer >= 1');
}
const e = venetianBlinds(params);

Type guard

function isPositiveInteger(value: unknown): value is number {
  return typeof value === 'number' && Number.isInteger(value) && value >= 1;
}

Prevention

When it happens

Trigger: Calling venetianBlinds({slats: 0}) or venetianBlinds({slats: -3}). Zero and negatives are integers but are meaningless for blind slat counts.

Common situations: Computed slat count from a formula that can reach zero (e.g. Math.floor(width / veryLargeNumber)); user input of 0; default-from-config that was set to 0 by mistake.

Related errors


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