remotion-dev/remotion · error · TypeError

A "duration" of a spring must be positive, but is ${dur}

Error message

A "duration" of a spring must be positive, but is ${dur}

What it means

`validateSpringDuration()` requires the optional `duration` (when provided) to be greater than zero. A non-positive duration is meaningless for a spring animation and would produce divide-by-zero or negative-frame outputs.

Source

Thrown at packages/core/src/validation/validation-spring-duration.ts:25

		throw new TypeError(
			`A "duration" of a spring must be a "number" but is "${typeof dur}"`,
		);
	}

	if (Number.isNaN(dur)) {
		throw new TypeError(
			'A "duration" of a spring is NaN, which it must not be',
		);
	}

	if (!Number.isFinite(dur)) {
		throw new TypeError(
			'A "duration" of a spring must be finite, but is ' + dur,
		);
	}

	if (dur <= 0) {
		throw new TypeError(
			'A "duration" of a spring must be positive, but is ' + dur,
		);
	}
};

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Pass a positive number of seconds, e.g. `duration: 1`.
  2. Clamp: `duration: Math.max(0.1, value)`.
  3. Omit `duration` entirely to use the default spring behavior.

Example fix

// before
spring({frame, fps, config, duration: 0});
// after
spring({frame, fps, config, duration: 1});
Defensive patterns

Strategy: validation

Validate before calling

const duration = Math.max(0.1, Number(rawDuration));

Type guard

const isPositiveDuration = (v: unknown): v is number => typeof v === 'number' && v > 0;

Prevention

When it happens

Trigger: Passing `duration: 0` or a negative number to `spring()`.

Common situations: Default-initializing `duration` to `0`, or computing it from a subtraction that can go negative.

Related errors


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