remotion-dev/remotion · error · Error

position must be a finite number.

Error message

position must be a finite number.

What it means

The add-guide MCP tool requires position to be a finite number (not NaN, Infinity, or a non-number).

Source

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

							position: {
								type: 'number',
								description:
									'The guide position in composition pixels. Vertical guides use an x-coordinate and horizontal guides use a y-coordinate.',
							},
						},
						required: ['orientation', 'position'],
						additionalProperties: false,
					},
					annotations: {readOnlyHint: false},
					execute: ({orientation, position}) => {
						if (orientation !== 'horizontal' && orientation !== 'vertical') {
							throw new Error(
								'orientation must be either "horizontal" or "vertical".',
							);
						}

						if (typeof position !== 'number' || !Number.isFinite(position)) {
							throw new Error('position must be a finite number.');
						}

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

						const guide: Guide = {
							id: crypto.randomUUID(),
							orientation,
							position,
							show: true,
							compositionId,
						};
						const nextGuides = [...guidesListRef.current, guide];
						guidesListRef.current = nextGuides;
						setGuidesList(() => nextGuides);
						persistGuidesList(nextGuides);

View on GitHub (pinned to b2f4e34732)

Solutions

  1. Pass a plain finite JSON number for position

Example fix

// before
{"orientation": "vertical", "position": "50%"}
// after
{"orientation": "vertical", "position": 540}
Defensive patterns

Strategy: validation

Validate before calling

if (typeof position !== 'number' || !Number.isFinite(position)) throw new Error('bad position');

Type guard

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

Prevention

When it happens

Trigger: Passing position as a string ("100"), null, NaN, or Infinity in the add-guide tool call.

Common situations: JSON tool calls from LLM clients that quote numbers or pass non-finite math results.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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