remotion-dev/remotion · error · TypeError

parameter 'timeoutInSeconds' must not be NaN, but is

Error message

parameter 'timeoutInSeconds' must not be NaN, but is

What it means

Thrown by validateTimeout() in @remotion/lambda when timeoutInSeconds is the number NaN. The validator runs this check before the range/integer checks; a NaN timeout is meaningless for Lambda deployment. Unlike validate-retries.ts, here the NaN guard is ordered before the finite guard, so this message IS reachable for a NaN input.

Source

Thrown at packages/lambda/src/shared/validate-timeout.ts:11

import {MAX_TIMEOUT, MIN_TIMEOUT} from '@remotion/lambda-client/constants';

export const validateTimeout = (timeoutInSeconds: unknown) => {
	if (typeof timeoutInSeconds !== 'number') {
		throw new TypeError(
			`parameter 'timeoutInSeconds' must be a number, but got a ${typeof timeoutInSeconds}`,
		);
	}

	if (Number.isNaN(timeoutInSeconds)) {
		throw new TypeError(`parameter 'timeoutInSeconds' must not be NaN, but is`);
	}

	if (!Number.isFinite(timeoutInSeconds)) {
		throw new TypeError(
			`parameter 'timeoutInSeconds' must be finite, but is ${timeoutInSeconds}`,
		);
	}

	if (timeoutInSeconds < MIN_TIMEOUT || timeoutInSeconds > MAX_TIMEOUT) {
		throw new TypeError(
			`parameter 'timeoutInSeconds' must be between ${MIN_TIMEOUT} and ${MAX_TIMEOUT}, but got ${timeoutInSeconds}`,
		);
	}

	if (timeoutInSeconds % 1 !== 0) {
		throw new TypeError(
			`parameter 'timeoutInSeconds' must be an integer but got ${timeoutInSeconds}`,
		);

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Source timeoutInSeconds from a known numeric default, e.g. const timeoutInSeconds = parsed ?? 120.
  2. Guard the parse: if (!Number.isFinite(Number(raw))) throw or default.
  3. Verify env vars are set before converting them.

Example fix

// before
const timeoutInSeconds = Number(process.env.LAMBDA_TIMEOUT); // NaN if unset

// after
const raw = Number(process.env.LAMBDA_TIMEOUT);
const timeoutInSeconds = Number.isFinite(raw) ? raw : 120;
Defensive patterns

Strategy: validation

Validate before calling

const raw = Number(process.env.LAMBDA_TIMEOUT);
const timeoutInSeconds = Number.isFinite(raw) ? Math.round(raw) : 120;

Type guard

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

Prevention

When it happens

Trigger: Passing timeoutInSeconds as the result of a NaN-producing expression: Number(undefined), parseInt(undefined), 0/0, or Math.sqrt(-1).

Common situations: Parsing an unset env var (Number(process.env.TIMEOUT) -> NaN), computing timeout from invalid input, or a malformed config value that fails Number conversion.

Understand the failure class

Related errors


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