remotion-dev/remotion · error · Error

zoom must be a finite number between 0 and 1.

Error message

zoom must be a finite number between 0 and 1.

What it means

The timeline zoom MCP tool requires zoom to be a finite number in [0, 1], where 1 is fully zoomed out. Values outside that range, NaN, or non-numbers throw.

Source

Thrown at packages/studio/src/components/WebMcp.tsx:1660

								type: 'number',
								minimum: 0,
								maximum: 1,
								description:
									'The normalized timeline zoom, from 0 (fully zoomed out) to 1 (maximum zoom).',
							},
						},
						required: ['zoom'],
						additionalProperties: false,
					},
					annotations: {readOnlyHint: false},
					execute: ({zoom}) => {
						if (
							typeof zoom !== 'number' ||
							!Number.isFinite(zoom) ||
							zoom < 0 ||
							zoom > 1
						) {
							throw new Error('zoom must be a finite number between 0 and 1.');
						}

						const compositionId = currentCompositionRef.current;
						if (compositionId === null) {
							throw new Error('No composition is currently selected.');
						}

						const durationInFrames = getCurrentDuration();
						if (durationInFrames <= 1) {
							throw new Error(
								'The current composition is a still and has no timeline zoom.',
							);
						}

						const timelineViewportWidth =
							scrollableRef.current?.clientWidth ?? 0;
						const minZoom = getTimelineMinZoom({
							durationInFrames,

View on GitHub (pinned to b2f4e34732)

Solutions

  1. Divide percentage values by 100 before passing
  2. Pass a number between 0 and 1

Example fix

// before
{"zoom": 50}
// after
{"zoom": 0.5}
Defensive patterns

Strategy: validation

Validate before calling

if (typeof zoom !== 'number' || !Number.isFinite(zoom) || zoom < 0 || zoom > 1) throw new Error('zoom must be in [0,1]');

Type guard

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

Prevention

When it happens

Trigger: Passing zoom as a percentage (e.g. 50 or 150), a string, or a negative number.

Common situations: Clients interpreting zoom as a percent (0-100) instead of the normalized 0-1 scale.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


AI-assisted analysis of remotion-dev/remotion@b2f4e34732 (2026-08-28). Data as JSON: /api/errors/7d5b80d16c69ec22. Report an issue: GitHub.